bbf : #3969 TR-181: Add Device.Bridging.ProviderBridge.{i} support (REBASE)

- Add support for provider bridge on devel
This commit is contained in:
Jomily K Joseph 2021-01-17 17:05:59 +00:00 committed by Amin Ben Ramdhane
parent 4ab2c7d9e6
commit 26c684593c
7 changed files with 1012 additions and 74 deletions

File diff suppressed because it is too large Load diff

View file

@ -24,5 +24,6 @@ extern DMLEAF tBridgingBridgePortParams[];
extern DMLEAF tBridgingBridgeVLANPortParams[];
extern DMOBJ tBridgingBridgePortObj[];
extern DMLEAF tBridgingBridgePortStatsParams[];
extern DMLEAF tBridgingProviderBridgeParams[];
#endif

View file

@ -77,7 +77,7 @@ void get_bridge_port_linker(struct dmctx *ctx, char *intf_name, char **value)
struct uci_section *dmmap_section = NULL, *bridge_port = NULL;
*value = NULL;
get_dmmap_section_of_config_section("dmmap_network", "interface", intf_name, &dmmap_section);
get_dmmap_section_of_config_section("dmmap_bridge", "bridge", intf_name, &dmmap_section);
if (dmmap_section != NULL) {
char *br_inst, *mg;
dmuci_get_value_by_section_string(dmmap_section, "bridge_instance", &br_inst);
@ -235,6 +235,10 @@ static int dmmap_synchronizeEthernetLink(struct dmctx *dmctx, DMNODE *parent_nod
if (*ifname == '\0' || strchr(ifname, '@'))
continue;
// If the section belong to provider bridge (section name: pr_br_{i}) then skip adding to dmmap_package
if (strncmp(section_name(s), "pr_br_", 6) == 0)
continue;
dmuci_get_value_by_section_string(s, "macaddr", &macaddr);
create_link(section_name(s), macaddr);
}

View file

@ -137,6 +137,10 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
strchr(ifname, '@'))
continue;
// Skip if its a provider bridge configuration
if (strncmp(section_name(s), "pr_br_", 6) == 0)
continue;
// The higher layer is Device.IP.Interface.{i}.
layer_inst = get_instance_by_section(dmctx->instance_mode, "dmmap_network", "interface", "section_name", section_name(s), "ip_int_instance", "ip_int_alias");
if (*layer_inst == '\0')
@ -301,7 +305,9 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
char *int_name;
dmuci_get_value_by_section_string(s, "section_name", &int_name);
struct uci_section *dmmap_section, *port;
get_dmmap_section_of_config_section("dmmap_network", "interface", int_name, &dmmap_section);
get_dmmap_section_of_config_section("dmmap_bridge", "bridge", int_name, &dmmap_section);
if (dmmap_section != NULL) {
char *br_inst, *mg;
dmuci_get_value_by_section_string(dmmap_section, "bridge_instance", &br_inst);
@ -350,13 +356,11 @@ int browseInterfaceStackInst(struct dmctx *dmctx, DMNODE *parent_node, void *pre
}
/* Higher layers are Device.Bridging.Bridge.{i}.Port.{i}.*/
uci_foreach_sections("network", "interface", s) {
char *type;
dmuci_get_value_by_section_string(s, "type", &type);
if (strcmp(type, "bridge") != 0)
continue;
uci_path_foreach_sections(bbfdm, "dmmap_bridge", "bridge", s) {
char *br_inst;
dmuci_get_value_by_section_string(s, "bridge_instance", &br_inst);
char *br_inst = get_instance_by_section(dmctx->instance_mode, "dmmap_network", "interface", "section_name", section_name(s), "bridge_instance", "bridge_alias");
if (*br_inst == '\0')
continue;

View file

@ -237,7 +237,7 @@ int get_mcast_snooping_interface_val(char *value, char *ifname, size_t s_ifname)
/* Find out bridge section name using bridge key. */
struct uci_section *s = NULL;
char *sec_name;
uci_path_foreach_option_eq(bbfdm, "dmmap_network", "interface", "bridge_instance", key, s) {
uci_path_foreach_option_eq(bbfdm, "dmmap_bridge", "bridge", "bridge_instance", key, s) {
dmuci_get_value_by_section_string(s, "section_name", &sec_name);
break;
}
@ -940,7 +940,7 @@ int get_mcast_snooping_interface(char *refparam, struct dmctx *ctx, void *data,
return 0;
strncpy(sec_name, end, sizeof(sec_name) - 1);
// In the dmmap_network file, the details related to the instance id etc. associated with this bridge
// In the dmmap_bridge file, the details related to the instance id etc. associated with this bridge
// is stored, we now switch our focus to it to extract the necessary information.
get_bridge_port_linker(ctx, sec_name, value);

View file

@ -48,6 +48,7 @@ char *ProfileEnable[] = {"Disabled", "Quiescent", "Enabled"};
char *SupportedOperatingChannelBandwidth[] = {"20MHz", "40MHz", "80MHz", "160MHZ", "80+80MHz", "Auto"};
char *SupportedStandards[] = {"a", "b", "g", "n", "ac", "ax"};
char *SupportedFrequencyBands[] = {"2.4GHz", "5GHz"};
char *Provider_Bridge_Type[] = {"S-VLAN", "PE"};
char *PIN[] = {"^\\d{4}|\\d{8}$"};
char *DestinationAddress[] = {"^\\d+/\\d+$"};
@ -366,7 +367,7 @@ void free_dmmap_config_dup_list(struct list_head *dup_list)
*/
struct uci_section *get_origin_section_from_config(char *package, char *section_type, char *orig_section_name)
{
struct uci_section *s;
struct uci_section *s = NULL;
uci_foreach_sections(package, section_type, s) {
if (strcmp(section_name(s), orig_section_name) == 0) {
@ -417,6 +418,14 @@ void synchronize_specific_config_sections_with_dmmap(char *package, char *sectio
char *v;
uci_foreach_sections(package, section_type, s) {
/*
* create/update corresponding dmmap section that have same config_section link and using param_value_array
* If the section belong to provider bridge (section name: pr_br_{i}) then skip adding to dmmap_package
*/
if ((strcmp(package, "network") == 0) &&
(strncmp(section_name(s), "pr_br_", 6) == 0))
continue;
/*
* create/update corresponding dmmap section that have same config_section link and using param_value_array
*/

View file

@ -111,6 +111,7 @@ extern char *IPv6Prefix[];
extern char *SupportedOperatingChannelBandwidth[];
extern char *SupportedStandards[];
extern char *SupportedFrequencyBands[];
extern char *Provider_Bridge_Type[];
#define UPTIME "/proc/uptime"
#define DEFAULT_CONFIG_DIR "/etc/config/"
@ -235,6 +236,7 @@ void synchronize_specific_config_sections_with_dmmap(char *package, char *sectio
void synchronize_specific_config_sections_with_dmmap_eq(char *package, char *section_type, char *dmmap_package,char* option_name, char* option_value, struct list_head *dup_list);
void synchronize_specific_config_sections_with_dmmap_cont(char *package, char *section_type, char *dmmap_package,char* option_name, char* option_value, struct list_head *dup_list);
void add_sysfs_section_list(struct list_head *dup_list, struct uci_section *dmmap_section, char *file_name, char *file_path);
void synchronize_specific_config_sections_with_dmmap_network(char *package, char *section_type, char *dmmap_package, struct list_head *dup_list);
int synchronize_system_folders_with_dmmap_opt(char *sysfsrep, char *dmmap_package, char *dmmap_section, char *opt_name, char* inst_opt, struct list_head *dup_list);
void get_dmmap_section_of_config_section(char* dmmap_package, char* section_type, char *section_name, struct uci_section **dmmap_section);
void get_dmmap_section_of_config_section_eq(char* dmmap_package, char* section_type, char *opt, char* value, struct uci_section **dmmap_section);