def __init__(self, *args, **kwargs): super(LIMirrorController, self).__init__(*args, **kwargs) self.tbl_num = self._service_manager.get_table_num(self.APP_NAME) self.next_table = self._service_manager.get_next_table_num( self.APP_NAME) self._mirror_all = kwargs['config'].get('li_mirror_all', False) self._li_local_port = kwargs['config'].get('li_local_iface', None) self._li_local_port_num = BridgeTools.get_ofport(self._li_local_port) self._li_dst_port = kwargs['config'].get('li_dst_iface', None) self._li_dst_port_num = BridgeTools.get_ofport(self._li_dst_port) self._datapath = None self._li_imsis = []
def _get_config(self, config_dict, mconfig) -> namedtuple: try: he_proxy_port = BridgeTools.get_ofport(config_dict.get('proxy_port_name')) he_enabled = config_dict.get('he_enabled', True) uplink_port = config_dict.get('uplink_port', None) except DatapathLookupError: he_enabled = False uplink_port = 0 he_proxy_port = 0 encryption_algorithm = None hash_function = None encoding_type = None encryption_enabled = False encryption_key = None if mconfig.he_config and mconfig.he_config.enable_encryption: encryption_enabled = True encryption_key = mconfig.he_config.encryption_key encryption_algorithm = mconfig.he_config.encryptionAlgorithm hash_function = mconfig.he_config.hashFunction encoding_type = mconfig.he_config.encodingType return self.UplinkConfig( gtp_port=config_dict['ovs_gtp_port_number'], he_proxy_port=he_proxy_port, he_enabled=he_enabled, encryption_enabled=encryption_enabled, encryption_algorithm=encryption_algorithm, hash_function=hash_function, encoding_type=encoding_type, encryption_key=encryption_key, uplink_port=uplink_port)
def __init__(self, *args, **kwargs): super(InOutController, self).__init__(*args, **kwargs) self.config = self._get_config(kwargs['config']) self._uplink_port = OFPP_LOCAL self._li_port = None #TODO Alex do we want this to be cofigurable from swagger? if self.config.mtr_ip: self._mtr_service_enabled = True else: self._mtr_service_enabled = False if (self.config.uplink_port_name): self._uplink_port = BridgeTools.get_ofport( self.config.uplink_port_name) if (self.config.li_port_name): self._li_port = BridgeTools.get_ofport(self.config.li_port_name) self._li_table = self._service_manager.get_table_num( LIMirrorController.APP_NAME) self._ingress_tbl_num = self._service_manager.get_table_num(INGRESS) self._midle_tbl_num = \ self._service_manager.get_table_num(PHYSICAL_TO_LOGICAL) self._egress_tbl_num = self._service_manager.get_table_num(EGRESS)
def _get_config(self, config_dict): port_no = config_dict.get('uplink_port', None) he_proxy_port = 0 he_proxy_eth_mac = '' try: if 'proxy_port_name' in config_dict: he_proxy_port = BridgeTools.get_ofport( config_dict.get('proxy_port_name')) he_proxy_eth_mac = config_dict.get('he_proxy_eth_mac', self.PROXY_PORT_MAC) except DatapathLookupError: # ignore it self.logger.debug("could not parse proxy port config") enable_nat = config_dict.get('enable_nat', True) non_nat_gw_probe_freq = config_dict.get( 'non_nat_gw_probe_frequency', self.ARP_PROBE_FREQUENCY, ) # In case of vlan tag on uplink_bridge, use separate port. sgi_vlan = config_dict.get('sgi_management_iface_vlan', "") if not sgi_vlan: non_nat_arp_egress_port = config_dict.get( 'non_nat_arp_egress_port', self.UPLINK_OVS_BRIDGE_NAME, ) else: non_nat_arp_egress_port = config_dict.get( 'non_nat_arp_egress_port', self.NON_NAT_ARP_EGRESS_PORT, ) virtual_iface = config_dict.get('virtual_interface', None) setup_type = config_dict.get('setup_type', None) if enable_nat is True or setup_type != 'LTE': if virtual_iface is not None: virtual_mac = get_virtual_iface_mac(virtual_iface) else: virtual_mac = "" else: # override virtual mac from config file. virtual_mac = config_dict.get('virtual_mac', "") uplink_gw_mac = config_dict.get( 'uplink_gw_mac', "ff:ff:ff:ff:ff:ff", ) li_port_name = None if 'li_local_iface' in config_dict: li_port_name = config_dict['li_local_iface'] return self.EgressConfig( gtp_port=config_dict['ovs_gtp_port_number'], uplink_port=port_no, li_port_name=li_port_name, enable_nat=enable_nat, non_nat_gw_probe_frequency=non_nat_gw_probe_freq, non_nat_arp_egress_port=non_nat_arp_egress_port, setup_type=setup_type, uplink_gw_mac=uplink_gw_mac, he_proxy_port=he_proxy_port, he_proxy_eth_mac=he_proxy_eth_mac, virtual_mac=virtual_mac, )