Commit 9898e884 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Service component - L3NM gNMI OpenConfig:

- Fixed selection of subinterface index
parent e2cb9a56
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -163,28 +163,29 @@ class EndpointComposer:
        json_config_rule = json_config_rule_delete if delete else json_config_rule_set

        config_rules : List[Dict] = list()
        if network_instance_name != DEFAULT_NETWORK_INSTANCE:
            config_rules.append(json_config_rule(*_network_instance_interface(
                network_instance_name, self.objekt.name, self.sub_interface_index
            )))

        vlan_id = None
        if self.force_trunk or access_vlan_tagged or len(self.explicit_vlan_ids) > 0:
            vlan_id = self._select_vlan_id(service_vlan_id)
            if vlan_id is None:
                LOGGER.warning('VLAN tagging requested but no vlan_id provided for endpoint={:s}'.format(self.uuid))
        sub_interface_index = vlan_id if vlan_id is not None else self.sub_interface_index

        if network_instance_name != DEFAULT_NETWORK_INSTANCE:
            config_rules.append(json_config_rule(*_network_instance_interface(
                network_instance_name, self.objekt.name, sub_interface_index
            )))

        if delete:
            config_rules.extend([
                json_config_rule(*_interface(
                    self.objekt.name, index=self.sub_interface_index, address_ip=None,
                    self.objekt.name, index=sub_interface_index, address_ip=None,
                    address_prefix=None, enabled=False, vlan_id=vlan_id
                )),
            ])
        else:
            config_rules.extend([
                json_config_rule(*_interface(
                    self.objekt.name, index=self.sub_interface_index, address_ip=self.ipv4_address,
                    self.objekt.name, index=sub_interface_index, address_ip=self.ipv4_address,
                    address_prefix=self.ipv4_prefix_len, enabled=True, vlan_id=vlan_id
                )),
            ])