Rename 'config' to 'cache' in the VPPApi.
This makes it clearer what its purpose is, in preparation of actual VPP dataplane configuration changes. For example remove_lcp() refers currently to the removal of the LCP from the cache, not the VPP dataplane itself, so rename it and its siblings cache_remove_*() instead. In a future commit, the call remove_*() will refer to the removal of an object _in VPP_.
This commit is contained in:
@ -50,7 +50,7 @@ class Reconciler():
|
||||
|
||||
ret = True
|
||||
for ifname in interface.get_phys(self.cfg):
|
||||
if not ifname in self.vpp.config['interface_names']:
|
||||
if not ifname in self.vpp.cache['interface_names']:
|
||||
self.logger.warning("Interface %s does not exist in VPP" % ifname)
|
||||
ret = False
|
||||
return ret
|
||||
@ -110,9 +110,9 @@ class Reconciler():
|
||||
""" Remove all addresses from interface ifname, except those in address_list,
|
||||
which may be an empty list, in which case all addresses are removed.
|
||||
"""
|
||||
idx = self.vpp.config['interface_names'][ifname].sw_if_index
|
||||
idx = self.vpp.cache['interface_names'][ifname].sw_if_index
|
||||
removed_addresses = []
|
||||
for a in self.vpp.config['interface_addresses'][idx]:
|
||||
for a in self.vpp.cache['interface_addresses'][idx]:
|
||||
if not a in address_list:
|
||||
cli = "set interface ip address del %s %s" % (ifname, a)
|
||||
self.cli['prune'].append(cli);
|
||||
@ -120,13 +120,13 @@ class Reconciler():
|
||||
else:
|
||||
self.logger.debug("Address OK: %s %s" % (ifname, a))
|
||||
for a in removed_addresses:
|
||||
self.vpp.config['interface_addresses'][idx].remove(a)
|
||||
self.vpp.cache['interface_addresses'][idx].remove(a)
|
||||
|
||||
def prune_loopbacks(self):
|
||||
""" Remove loopbacks from VPP, if they do not occur in the config. """
|
||||
removed_interfaces=[]
|
||||
for numtags in [ 2, 1, 0 ]:
|
||||
for idx, vpp_iface in self.vpp.config['interfaces'].items():
|
||||
for idx, vpp_iface in self.vpp.cache['interfaces'].items():
|
||||
if vpp_iface.interface_dev_type!='Loopback':
|
||||
continue
|
||||
if vpp_iface.sub_number_of_tags != numtags:
|
||||
@ -150,7 +150,7 @@ class Reconciler():
|
||||
self.prune_addresses(vpp_iface.interface_name, addresses)
|
||||
|
||||
for ifname in removed_interfaces:
|
||||
self.vpp.remove_interface(ifname)
|
||||
self.vpp.cache_remove_interface(ifname)
|
||||
|
||||
return True
|
||||
|
||||
@ -158,7 +158,7 @@ class Reconciler():
|
||||
def prune_bridgedomains(self):
|
||||
""" Remove bridge-domains from VPP, if they do not occur in the config. If any interfaces are
|
||||
found in to-be removed bridge-domains, they are returned to L3 mode, and tag-rewrites removed. """
|
||||
for idx, bridge in self.vpp.config['bridgedomains'].items():
|
||||
for idx, bridge in self.vpp.cache['bridgedomains'].items():
|
||||
bridgename = "bd%d" % idx
|
||||
config_ifname, config_iface = bridgedomain.get_by_name(self.cfg, bridgename)
|
||||
members = []
|
||||
@ -166,15 +166,15 @@ class Reconciler():
|
||||
for member in bridge.sw_if_details:
|
||||
if member.sw_if_index == bridge.bvi_sw_if_index:
|
||||
continue
|
||||
member_iface = self.vpp.config['interfaces'][member.sw_if_index]
|
||||
member_iface = self.vpp.cache['interfaces'][member.sw_if_index]
|
||||
member_ifname = member_iface.interface_name
|
||||
if member_iface.sub_id > 0:
|
||||
cli="set interface l2 tag-rewrite %s disable" % (member_ifname)
|
||||
self.cli['prune'].append(cli);
|
||||
cli="set interface l3 %s" % (member_ifname)
|
||||
self.cli['prune'].append(cli);
|
||||
if bridge.bvi_sw_if_index in self.vpp.config['interfaces']:
|
||||
bviname = self.vpp.config['interfaces'][bridge.bvi_sw_if_index].interface_name
|
||||
if bridge.bvi_sw_if_index in self.vpp.cache['interfaces']:
|
||||
bviname = self.vpp.cache['interfaces'][bridge.bvi_sw_if_index].interface_name
|
||||
cli="set interface l3 %s" % (bviname)
|
||||
self.cli['prune'].append(cli);
|
||||
cli="create bridge-domain %d del" % (idx)
|
||||
@ -182,15 +182,15 @@ class Reconciler():
|
||||
else:
|
||||
self.logger.debug("BridgeDomain OK: %s" % (bridgename))
|
||||
for member in bridge.sw_if_details:
|
||||
member_ifname = self.vpp.config['interfaces'][member.sw_if_index].interface_name
|
||||
member_ifname = self.vpp.cache['interfaces'][member.sw_if_index].interface_name
|
||||
if 'members' in config_iface and member_ifname in config_iface['members']:
|
||||
if interface.is_sub(self.cfg, member_ifname):
|
||||
cli="set interface l2 tag-rewrite %s disable" % (member_ifname)
|
||||
self.cli['prune'].append(cli);
|
||||
cli="set interface l3 %s" % (member_ifname)
|
||||
self.cli['prune'].append(cli);
|
||||
if 'bvi' in config_iface and bridge.bvi_sw_if_index in self.vpp.config['interfaces']:
|
||||
bviname = self.vpp.config['interfaces'][bridge.bvi_sw_if_index].interface_name
|
||||
if 'bvi' in config_iface and bridge.bvi_sw_if_index in self.vpp.cache['interfaces']:
|
||||
bviname = self.vpp.cache['interfaces'][bridge.bvi_sw_if_index].interface_name
|
||||
if bviname != config_iface['bvi']:
|
||||
cli="set interface l3 %s" % (bviname)
|
||||
self.cli['prune'].append(cli);
|
||||
@ -202,11 +202,11 @@ class Reconciler():
|
||||
but are crossconnected to a different interface name, also remove them. Interfaces are put
|
||||
back into L3 mode, and their tag-rewrites removed. """
|
||||
removed_l2xcs=[]
|
||||
for idx, l2xc in self.vpp.config['l2xcs'].items():
|
||||
vpp_rx_ifname = self.vpp.config['interfaces'][l2xc.rx_sw_if_index].interface_name
|
||||
for idx, l2xc in self.vpp.cache['l2xcs'].items():
|
||||
vpp_rx_ifname = self.vpp.cache['interfaces'][l2xc.rx_sw_if_index].interface_name
|
||||
config_rx_ifname, config_rx_iface = interface.get_by_name(self.cfg, vpp_rx_ifname)
|
||||
if not config_rx_ifname:
|
||||
if self.vpp.config['interfaces'][l2xc.rx_sw_if_index].sub_id > 0:
|
||||
if self.vpp.cache['interfaces'][l2xc.rx_sw_if_index].sub_id > 0:
|
||||
cli="set interface l2 tag-rewrite %s disable" % (vpp_rx_ifname)
|
||||
self.cli['prune'].append(cli);
|
||||
cli="set interface l3 %s" % (vpp_rx_ifname)
|
||||
@ -222,7 +222,7 @@ class Reconciler():
|
||||
self.cli['prune'].append(cli);
|
||||
removed_l2xcs.append(vpp_rx_ifname)
|
||||
continue
|
||||
vpp_tx_ifname = self.vpp.config['interfaces'][l2xc.tx_sw_if_index].interface_name
|
||||
vpp_tx_ifname = self.vpp.cache['interfaces'][l2xc.tx_sw_if_index].interface_name
|
||||
if vpp_tx_ifname != config_rx_iface['l2xc']:
|
||||
if interface.is_sub(self.cfg, config_rx_ifname):
|
||||
cli="set interface l2 tag-rewrite %s disable" % (vpp_rx_ifname)
|
||||
@ -233,7 +233,7 @@ class Reconciler():
|
||||
continue
|
||||
self.logger.debug("L2XC OK: %s -> %s" % (vpp_rx_ifname, vpp_tx_ifname))
|
||||
for l2xc in removed_l2xcs:
|
||||
self.vpp.remove_l2xc(l2xc)
|
||||
self.vpp.cache_remove_l2xc(l2xc)
|
||||
return True
|
||||
|
||||
def prune_bondethernets(self):
|
||||
@ -241,13 +241,13 @@ class Reconciler():
|
||||
remove those from the bond before removing the bond. """
|
||||
removed_interfaces=[]
|
||||
removed_bondethernet_members=[]
|
||||
for idx, bond in self.vpp.config['bondethernets'].items():
|
||||
for idx, bond in self.vpp.cache['bondethernets'].items():
|
||||
vpp_ifname = bond.interface_name
|
||||
config_ifname, config_iface = bondethernet.get_by_name(self.cfg, vpp_ifname)
|
||||
if not config_iface:
|
||||
self.prune_addresses(vpp_ifname, [])
|
||||
for member in self.vpp.config['bondethernet_members'][idx]:
|
||||
member_ifname = self.vpp.config['interfaces'][member].interface_name
|
||||
for member in self.vpp.cache['bondethernet_members'][idx]:
|
||||
member_ifname = self.vpp.cache['interfaces'][member].interface_name
|
||||
cli="bond del %s" % (member_ifname)
|
||||
self.cli['prune'].append(cli);
|
||||
removed_bondethernet_members.append(member_ifname)
|
||||
@ -255,8 +255,8 @@ class Reconciler():
|
||||
self.cli['prune'].append(cli);
|
||||
removed_interfaces.append(vpp_ifname)
|
||||
continue
|
||||
for member in self.vpp.config['bondethernet_members'][idx]:
|
||||
member_ifname = self.vpp.config['interfaces'][member].interface_name
|
||||
for member in self.vpp.cache['bondethernet_members'][idx]:
|
||||
member_ifname = self.vpp.cache['interfaces'][member].interface_name
|
||||
if 'interfaces' in config_iface and not member_ifname in config_iface['interfaces']:
|
||||
cli="bond del %s" % (member_ifname)
|
||||
self.cli['prune'].append(cli);
|
||||
@ -268,10 +268,10 @@ class Reconciler():
|
||||
self.logger.debug("BondEthernet OK: %s" % (vpp_ifname))
|
||||
|
||||
for ifname in removed_bondethernet_members:
|
||||
self.vpp.remove_bondethernet_member(ifname)
|
||||
self.vpp.cache_remove_bondethernet_member(ifname)
|
||||
|
||||
for ifname in removed_interfaces:
|
||||
self.vpp.remove_interface(ifname)
|
||||
self.vpp.cache_remove_interface(ifname)
|
||||
|
||||
return True
|
||||
|
||||
@ -279,8 +279,8 @@ class Reconciler():
|
||||
""" Remove all VXLAN Tunnels from VPP, if they are not in the config. If they are in the config
|
||||
but with differing attributes, remove them also. """
|
||||
removed_interfaces=[]
|
||||
for idx, vpp_vxlan in self.vpp.config['vxlan_tunnels'].items():
|
||||
vpp_ifname = self.vpp.config['interfaces'][idx].interface_name
|
||||
for idx, vpp_vxlan in self.vpp.cache['vxlan_tunnels'].items():
|
||||
vpp_ifname = self.vpp.cache['interfaces'][idx].interface_name
|
||||
config_ifname, config_iface = vxlan_tunnel.get_by_name(self.cfg, vpp_ifname)
|
||||
if not config_iface:
|
||||
cli="create vxlan tunnel instance %d src %s dst %s vni %d del" % (vpp_vxlan.instance,
|
||||
@ -301,23 +301,23 @@ class Reconciler():
|
||||
self.logger.debug("VXLAN Tunnel OK: %s" % (vpp_ifname))
|
||||
|
||||
for ifname in removed_interfaces:
|
||||
self.vpp.remove_vxlan_tunnel(ifname)
|
||||
self.vpp.remove_interface(ifname)
|
||||
self.vpp.cache_remove_vxlan_tunnel(ifname)
|
||||
self.vpp.cache_remove_interface(ifname)
|
||||
|
||||
return True
|
||||
|
||||
def __tap_is_lcp(self, sw_if_index):
|
||||
""" Returns True if the given sw_if_index is a TAP interface belonging to an LCP,
|
||||
or False otherwise."""
|
||||
if not sw_if_index in self.vpp.config['interfaces']:
|
||||
if not sw_if_index in self.vpp.cache['interfaces']:
|
||||
return False
|
||||
|
||||
vpp_iface = self.vpp.config['interfaces'][sw_if_index]
|
||||
vpp_iface = self.vpp.cache['interfaces'][sw_if_index]
|
||||
if not vpp_iface.interface_dev_type=="virtio":
|
||||
return False
|
||||
|
||||
match = False
|
||||
for idx, lcp in self.vpp.config['lcps'].items():
|
||||
for idx, lcp in self.vpp.cache['lcps'].items():
|
||||
if vpp_iface.sw_if_index == lcp.host_sw_if_index:
|
||||
match = True
|
||||
return match
|
||||
@ -328,7 +328,7 @@ class Reconciler():
|
||||
removed_interfaces=[]
|
||||
for numtags in [ 2, 1 ]:
|
||||
for vpp_ifname in self.vpp.get_sub_interfaces():
|
||||
vpp_iface = self.vpp.config['interface_names'][vpp_ifname]
|
||||
vpp_iface = self.vpp.cache['interface_names'][vpp_ifname]
|
||||
if vpp_iface.sub_number_of_tags != numtags:
|
||||
continue
|
||||
|
||||
@ -357,14 +357,14 @@ class Reconciler():
|
||||
self.logger.debug("Sub Interface OK: %s" % (vpp_ifname))
|
||||
|
||||
for ifname in removed_interfaces:
|
||||
self.vpp.remove_interface(ifname)
|
||||
self.vpp.cache_remove_interface(ifname)
|
||||
|
||||
return True
|
||||
|
||||
def prune_phys(self):
|
||||
""" Set default MTU and remove IPs for PHYs that are not in the config. """
|
||||
for vpp_ifname in self.vpp.get_phys():
|
||||
vpp_iface = self.vpp.config['interface_names'][vpp_ifname]
|
||||
vpp_iface = self.vpp.cache['interface_names'][vpp_ifname]
|
||||
config_ifname, config_iface = interface.get_by_name(self.cfg, vpp_ifname)
|
||||
if not config_iface:
|
||||
## Interfaces were sent DOWN in the prune_admin_state() step previously
|
||||
@ -384,7 +384,7 @@ class Reconciler():
|
||||
""" Returns the sw_if_index of an interface on a given super_sw_if_index with given dot1q/dot1ad outer and inner-dot1q=0,
|
||||
in other words the intermediary Dot1Q/Dot1AD belonging to a QinX interface. If the interface doesn't exist, None is
|
||||
returned. """
|
||||
for idx, iface in self.vpp.config['interfaces'].items():
|
||||
for idx, iface in self.vpp.cache['interfaces'].items():
|
||||
if iface.sup_sw_if_index != sup_sw_if_index:
|
||||
continue
|
||||
if iface.sub_inner_vlan_id > 0:
|
||||
@ -423,12 +423,12 @@ class Reconciler():
|
||||
Order is important: destroying an LCP of a PHY will invalidate its Dot1Q/Dot1AD as well as their
|
||||
downstream children in Linux.
|
||||
"""
|
||||
lcps = self.vpp.config['lcps']
|
||||
lcps = self.vpp.cache['lcps']
|
||||
|
||||
removed_lcps = []
|
||||
for numtags in [ 2, 1, 0 ]:
|
||||
for idx, lcp in lcps.items():
|
||||
vpp_iface = self.vpp.config['interfaces'][lcp.phy_sw_if_index]
|
||||
vpp_iface = self.vpp.cache['interfaces'][lcp.phy_sw_if_index]
|
||||
if vpp_iface.sub_number_of_tags != numtags:
|
||||
continue
|
||||
if vpp_iface.interface_dev_type=='Loopback':
|
||||
@ -449,7 +449,7 @@ class Reconciler():
|
||||
continue
|
||||
if vpp_iface.sub_number_of_tags == 2:
|
||||
vpp_parent_idx = self.__parent_iface_by_encap(vpp_iface.sup_sw_if_index, vpp_iface.sub_outer_vlan_id, vpp_iface.sub_if_flags&8)
|
||||
vpp_parent_iface = self.vpp.config['interfaces'][vpp_parent_idx]
|
||||
vpp_parent_iface = self.vpp.cache['interfaces'][vpp_parent_idx]
|
||||
parent_lcp = lcps[vpp_parent_iface.sw_if_index]
|
||||
config_parent_ifname, config_parent_iface = interface.get_by_lcp_name(self.cfg, parent_lcp.host_if_name)
|
||||
if not config_parent_iface:
|
||||
@ -517,14 +517,14 @@ class Reconciler():
|
||||
self.logger.debug("LCP OK: %s -> (vpp=%s, config=%s)" % (lcp.host_if_name, vpp_iface.interface_name, config_ifname))
|
||||
|
||||
for lcpname in removed_lcps:
|
||||
self.vpp.remove_lcp(lcpname)
|
||||
self.vpp.cache_remove_lcp(lcpname)
|
||||
return True
|
||||
|
||||
def prune_admin_state(self):
|
||||
""" Set admin-state down for all interfaces that are not in the config. """
|
||||
for ifname in self.vpp.get_qinx_interfaces() + self.vpp.get_dot1x_interfaces() + self.vpp.get_bondethernets() + self.vpp.get_phys() + self.vpp.get_vxlan_tunnels() + self.vpp.get_loopbacks():
|
||||
if not ifname in interface.get_interfaces(self.cfg) + loopback.get_loopbacks(self.cfg):
|
||||
vpp_iface = self.vpp.config['interface_names'][ifname]
|
||||
vpp_iface = self.vpp.cache['interface_names'][ifname]
|
||||
|
||||
if self.__tap_is_lcp(vpp_iface.sw_if_index):
|
||||
continue
|
||||
@ -562,7 +562,7 @@ class Reconciler():
|
||||
|
||||
def create_loopbacks(self):
|
||||
for ifname in loopback.get_loopbacks(self.cfg):
|
||||
if ifname in self.vpp.config['interface_names']:
|
||||
if ifname in self.vpp.cache['interface_names']:
|
||||
continue
|
||||
instance = int(ifname[4:])
|
||||
cli="create loopback interface instance %d" % (instance)
|
||||
@ -571,7 +571,7 @@ class Reconciler():
|
||||
|
||||
def create_bondethernets(self):
|
||||
for ifname in bondethernet.get_bondethernets(self.cfg):
|
||||
if ifname in self.vpp.config['interface_names']:
|
||||
if ifname in self.vpp.cache['interface_names']:
|
||||
continue
|
||||
ifname, iface = bondethernet.get_by_name(self.cfg, ifname)
|
||||
instance = int(ifname[12:])
|
||||
@ -581,7 +581,7 @@ class Reconciler():
|
||||
|
||||
def create_vxlan_tunnels(self):
|
||||
for ifname in vxlan_tunnel.get_vxlan_tunnels(self.cfg):
|
||||
if ifname in self.vpp.config['interface_names']:
|
||||
if ifname in self.vpp.cache['interface_names']:
|
||||
continue
|
||||
ifname, iface = vxlan_tunnel.get_by_name(self.cfg, ifname)
|
||||
instance = int(ifname[12:])
|
||||
@ -598,7 +598,7 @@ class Reconciler():
|
||||
continue
|
||||
|
||||
ifname, iface = interface.get_by_name(self.cfg, ifname)
|
||||
if ifname in self.vpp.config['interface_names']:
|
||||
if ifname in self.vpp.cache['interface_names']:
|
||||
continue
|
||||
|
||||
## Assemble the encapsulation string
|
||||
@ -620,14 +620,14 @@ class Reconciler():
|
||||
for ifname in bridgedomain.get_bridgedomains(self.cfg):
|
||||
ifname, iface = bridgedomain.get_by_name(self.cfg, ifname)
|
||||
instance = int(ifname[2:])
|
||||
if instance in self.vpp.config['bridgedomains']:
|
||||
if instance in self.vpp.cache['bridgedomains']:
|
||||
continue
|
||||
cli="create bridge-domain %s" % (instance)
|
||||
self.cli['create'].append(cli);
|
||||
return True
|
||||
|
||||
def create_lcps(self):
|
||||
lcpnames = [self.vpp.config['lcps'][x].host_if_name for x in self.vpp.config['lcps']]
|
||||
lcpnames = [self.vpp.cache['lcps'][x].host_if_name for x in self.vpp.cache['lcps']]
|
||||
|
||||
## First create untagged ...
|
||||
for ifname in interface.get_interfaces(self.cfg) + loopback.get_loopbacks(self.cfg):
|
||||
@ -683,9 +683,9 @@ class Reconciler():
|
||||
|
||||
def sync_bondethernets(self):
|
||||
for ifname in bondethernet.get_bondethernets(self.cfg):
|
||||
if ifname in self.vpp.config['interface_names']:
|
||||
vpp_bond_sw_if_index = self.vpp.config['interface_names'][ifname].sw_if_index
|
||||
vpp_members = [self.vpp.config['interfaces'][x].interface_name for x in self.vpp.config['bondethernet_members'][vpp_bond_sw_if_index]]
|
||||
if ifname in self.vpp.cache['interface_names']:
|
||||
vpp_bond_sw_if_index = self.vpp.cache['interface_names'][ifname].sw_if_index
|
||||
vpp_members = [self.vpp.cache['interfaces'][x].interface_name for x in self.vpp.cache['bondethernet_members'][vpp_bond_sw_if_index]]
|
||||
else:
|
||||
## New BondEthernet
|
||||
vpp_members = []
|
||||
@ -697,7 +697,7 @@ class Reconciler():
|
||||
bondmac = None
|
||||
for member_ifname in sorted(config_bond_iface['interfaces']):
|
||||
member_ifname, member_iface = interface.get_by_name(self.cfg, member_ifname)
|
||||
member_iface = self.vpp.config['interface_names'][member_ifname]
|
||||
member_iface = self.vpp.cache['interface_names'][member_ifname]
|
||||
if not member_ifname in vpp_members:
|
||||
if len(vpp_members) == 0:
|
||||
bondmac = member_iface.l2_address
|
||||
@ -717,11 +717,11 @@ class Reconciler():
|
||||
def sync_bridgedomains(self):
|
||||
for ifname in bridgedomain.get_bridgedomains(self.cfg):
|
||||
instance = int(ifname[2:])
|
||||
if instance in self.vpp.config['bridgedomains']:
|
||||
vpp_bridge = self.vpp.config['bridgedomains'][instance]
|
||||
if instance in self.vpp.cache['bridgedomains']:
|
||||
vpp_bridge = self.vpp.cache['bridgedomains'][instance]
|
||||
bvi_sw_if_index = vpp_bridge.bvi_sw_if_index
|
||||
bridge_sw_if_index_list = [x.sw_if_index for x in vpp_bridge.sw_if_details]
|
||||
bridge_members = [self.vpp.config['interfaces'][x].interface_name for x in bridge_sw_if_index_list if x in self.vpp.config['interfaces']]
|
||||
bridge_members = [self.vpp.cache['interfaces'][x].interface_name for x in bridge_sw_if_index_list if x in self.vpp.cache['interfaces']]
|
||||
else:
|
||||
## New BridgeDomain
|
||||
bvi_sw_if_index = -1
|
||||
@ -732,7 +732,7 @@ class Reconciler():
|
||||
continue
|
||||
if 'bvi' in config_bridge_iface:
|
||||
bviname = config_bridge_iface['bvi']
|
||||
if bviname in self.vpp.config['interface_names'] and self.vpp.config['interface_names'][bviname].sw_if_index == bvi_sw_if_index:
|
||||
if bviname in self.vpp.cache['interface_names'] and self.vpp.cache['interface_names'][bviname].sw_if_index == bvi_sw_if_index:
|
||||
continue
|
||||
cli="set interface l2 bridge %s %d bvi" % (bviname, instance)
|
||||
self.cli['sync'].append(cli);
|
||||
@ -757,21 +757,21 @@ class Reconciler():
|
||||
config_tx_ifname, config_tx_iface = interface.get_by_name(self.cfg, config_rx_iface['l2xc'])
|
||||
vpp_rx_iface = None
|
||||
vpp_tx_iface = None
|
||||
if config_rx_ifname in self.vpp.config['interface_names']:
|
||||
vpp_rx_iface = self.vpp.config['interface_names'][config_rx_ifname]
|
||||
if config_tx_ifname in self.vpp.config['interface_names']:
|
||||
vpp_tx_iface = self.vpp.config['interface_names'][config_tx_ifname]
|
||||
if config_rx_ifname in self.vpp.cache['interface_names']:
|
||||
vpp_rx_iface = self.vpp.cache['interface_names'][config_rx_ifname]
|
||||
if config_tx_ifname in self.vpp.cache['interface_names']:
|
||||
vpp_tx_iface = self.vpp.cache['interface_names'][config_tx_ifname]
|
||||
|
||||
l2xc_changed = False
|
||||
if not vpp_rx_iface or not vpp_tx_iface:
|
||||
cli="set interface l2 xconnect %s %s" % (config_rx_ifname, config_tx_ifname)
|
||||
self.cli['sync'].append(cli);
|
||||
l2xc_changed = True
|
||||
elif not vpp_rx_iface.sw_if_index in self.vpp.config['l2xcs']:
|
||||
elif not vpp_rx_iface.sw_if_index in self.vpp.cache['l2xcs']:
|
||||
cli="set interface l2 xconnect %s %s" % (config_rx_ifname, config_tx_ifname)
|
||||
self.cli['sync'].append(cli);
|
||||
l2xc_changed = True
|
||||
elif not vpp_tx_iface.sw_if_index == self.vpp.config['l2xcs'][vpp_rx_iface.sw_if_index].tx_sw_if_index:
|
||||
elif not vpp_tx_iface.sw_if_index == self.vpp.cache['l2xcs'][vpp_rx_iface.sw_if_index].tx_sw_if_index:
|
||||
cli="set interface l2 xconnect %s %s" % (config_rx_ifname, config_tx_ifname)
|
||||
self.cli['sync'].append(cli);
|
||||
l2xc_changed = True
|
||||
@ -804,16 +804,16 @@ class Reconciler():
|
||||
config_mtu = 1500
|
||||
vpp_mtu = 9000
|
||||
if ifname.startswith("loop"):
|
||||
if ifname in self.vpp.config['interface_names']:
|
||||
vpp_mtu = self.vpp.config['interface_names'][ifname].mtu[0]
|
||||
if ifname in self.vpp.cache['interface_names']:
|
||||
vpp_mtu = self.vpp.cache['interface_names'][ifname].mtu[0]
|
||||
vpp_ifname, config_iface = loopback.get_by_name(self.cfg, ifname)
|
||||
if 'mtu' in config_iface:
|
||||
config_mtu = config_iface['mtu']
|
||||
else:
|
||||
if numtags > 0:
|
||||
vpp_mtu = 0
|
||||
if ifname in self.vpp.config['interface_names']:
|
||||
vpp_mtu = self.vpp.config['interface_names'][ifname].mtu[0]
|
||||
if ifname in self.vpp.cache['interface_names']:
|
||||
vpp_mtu = self.vpp.cache['interface_names'][ifname].mtu[0]
|
||||
vpp_ifname, config_iface = interface.get_by_name(self.cfg, ifname)
|
||||
config_mtu = interface.get_mtu(self.cfg, ifname)
|
||||
|
||||
@ -826,7 +826,7 @@ class Reconciler():
|
||||
return True
|
||||
|
||||
def sync_link_mtu_direction(self, shrink=True):
|
||||
for idx, vpp_iface in self.vpp.config['interfaces'].items():
|
||||
for idx, vpp_iface in self.vpp.cache['interfaces'].items():
|
||||
if vpp_iface.sub_number_of_tags != 0:
|
||||
continue
|
||||
if vpp_iface.interface_dev_type in ['local', 'Loopback', 'VXLAN', 'virtio']:
|
||||
@ -899,10 +899,10 @@ class Reconciler():
|
||||
vpp_ifname, config_iface = interface.get_by_name(self.cfg, ifname)
|
||||
if 'addresses' in config_iface:
|
||||
config_addresses = config_iface['addresses']
|
||||
if vpp_ifname in self.vpp.config['interface_names']:
|
||||
sw_if_index = self.vpp.config['interface_names'][vpp_ifname].sw_if_index
|
||||
if sw_if_index in self.vpp.config['interface_addresses']:
|
||||
vpp_addresses = [str(x) for x in self.vpp.config['interface_addresses'][sw_if_index]]
|
||||
if vpp_ifname in self.vpp.cache['interface_names']:
|
||||
sw_if_index = self.vpp.cache['interface_names'][vpp_ifname].sw_if_index
|
||||
if sw_if_index in self.vpp.cache['interface_addresses']:
|
||||
vpp_addresses = [str(x) for x in self.vpp.cache['interface_addresses'][sw_if_index]]
|
||||
for a in config_addresses:
|
||||
if a in vpp_addresses:
|
||||
continue
|
||||
@ -920,8 +920,8 @@ class Reconciler():
|
||||
config_admin_state = 1
|
||||
|
||||
vpp_admin_state = 0
|
||||
if vpp_ifname in self.vpp.config['interface_names']:
|
||||
vpp_admin_state = self.vpp.config['interface_names'][vpp_ifname].flags & 1 # IF_STATUS_API_FLAG_ADMIN_UP
|
||||
if vpp_ifname in self.vpp.cache['interface_names']:
|
||||
vpp_admin_state = self.vpp.cache['interface_names'][vpp_ifname].flags & 1 # IF_STATUS_API_FLAG_ADMIN_UP
|
||||
if config_admin_state == vpp_admin_state:
|
||||
continue
|
||||
state="up"
|
||||
|
160
vpp/vppapi.py
160
vpp/vppapi.py
@ -18,8 +18,8 @@ class VPPApi():
|
||||
self.connected = False
|
||||
self.clientname = clientname
|
||||
self.vpp = None
|
||||
self.config = self.clearconfig()
|
||||
self.config_read = False
|
||||
self.cache = self.cache_clear()
|
||||
self.cache_read = False
|
||||
self.lcp_enabled = False
|
||||
|
||||
def connect(self):
|
||||
@ -62,15 +62,15 @@ class VPPApi():
|
||||
self.connected = False
|
||||
return True
|
||||
|
||||
def clearconfig(self):
|
||||
self.config_read = False
|
||||
def cache_clear(self):
|
||||
self.cache_read = False
|
||||
return {"lcps": {}, "interface_names": {}, "interfaces": {}, "interface_addresses": {},
|
||||
"bondethernets": {}, "bondethernet_members": {},
|
||||
"bridgedomains": {}, "vxlan_tunnels": {}, "l2xcs": {}}
|
||||
|
||||
def remove_lcp(self, lcpname):
|
||||
def cache_remove_lcp(self, lcpname):
|
||||
""" Removes the LCP and TAP interface, identified by lcpname, from the config. """
|
||||
for idx, lcp in self.config['lcps'].items():
|
||||
for idx, lcp in self.cache['lcps'].items():
|
||||
if lcp.host_if_name == lcpname:
|
||||
found = True
|
||||
break
|
||||
@ -78,63 +78,63 @@ class VPPApi():
|
||||
self.logger.warning("Trying to remove an LCP which is not in the config: %s" % lcpname)
|
||||
return False
|
||||
|
||||
ifname = self.config['interfaces'][lcp.host_sw_if_index].interface_name
|
||||
del self.config['interface_names'][ifname]
|
||||
del self.config['interface_addresses'][lcp.host_sw_if_index]
|
||||
del self.config['interfaces'][lcp.host_sw_if_index]
|
||||
del self.config['lcps'][lcp.phy_sw_if_index]
|
||||
ifname = self.cache['interfaces'][lcp.host_sw_if_index].interface_name
|
||||
del self.cache['interface_names'][ifname]
|
||||
del self.cache['interface_addresses'][lcp.host_sw_if_index]
|
||||
del self.cache['interfaces'][lcp.host_sw_if_index]
|
||||
del self.cache['lcps'][lcp.phy_sw_if_index]
|
||||
return True
|
||||
|
||||
def remove_bondethernet_member(self, ifname):
|
||||
def cache_remove_bondethernet_member(self, ifname):
|
||||
""" Removes the bonderthernet member interface, identified by name, from the config. """
|
||||
if not ifname in self.config['interface_names']:
|
||||
if not ifname in self.cache['interface_names']:
|
||||
self.logger.warning("Trying to remove a bondethernet member interface which is not in the config: %s" % ifname)
|
||||
return False
|
||||
|
||||
iface = self.config['interface_names'][ifname]
|
||||
for bond_idx, members in self.config['bondethernet_members'].items():
|
||||
iface = self.cache['interface_names'][ifname]
|
||||
for bond_idx, members in self.cache['bondethernet_members'].items():
|
||||
if iface.sw_if_index in members:
|
||||
self.config['bondethernet_members'][bond_idx].remove(iface.sw_if_index)
|
||||
self.cache['bondethernet_members'][bond_idx].remove(iface.sw_if_index)
|
||||
|
||||
return True
|
||||
|
||||
def remove_l2xc(self, ifname):
|
||||
if not ifname in self.config['interface_names']:
|
||||
def cache_remove_l2xc(self, ifname):
|
||||
if not ifname in self.cache['interface_names']:
|
||||
self.logger.warning("Trying to remove an L2XC which is not in the config: %s" % ifname)
|
||||
return False
|
||||
iface = self.config['interface_names'][ifname]
|
||||
self.config['l2xcs'].pop(iface.sw_if_index, None)
|
||||
iface = self.cache['interface_names'][ifname]
|
||||
self.cache['l2xcs'].pop(iface.sw_if_index, None)
|
||||
return True
|
||||
|
||||
def remove_vxlan_tunnel(self, ifname):
|
||||
if not ifname in self.config['interface_names']:
|
||||
def cache_remove_vxlan_tunnel(self, ifname):
|
||||
if not ifname in self.cache['interface_names']:
|
||||
self.logger.warning("Trying to remove a VXLAN Tunnel which is not in the config: %s" % ifname)
|
||||
return False
|
||||
|
||||
iface = self.config['interface_names'][ifname]
|
||||
self.config['vxlan_tunnels'].pop(iface.sw_if_index, None)
|
||||
iface = self.cache['interface_names'][ifname]
|
||||
self.cache['vxlan_tunnels'].pop(iface.sw_if_index, None)
|
||||
return True
|
||||
|
||||
def remove_interface(self, ifname):
|
||||
def cache_remove_interface(self, ifname):
|
||||
""" Removes the interface, identified by name, from the config. """
|
||||
if not ifname in self.config['interface_names']:
|
||||
if not ifname in self.cache['interface_names']:
|
||||
self.logger.warning("Trying to remove an interface which is not in the config: %s" % ifname)
|
||||
return False
|
||||
|
||||
iface = self.config['interface_names'][ifname]
|
||||
del self.config['interfaces'][iface.sw_if_index]
|
||||
if len(self.config['interface_addresses'][iface.sw_if_index]) > 0:
|
||||
iface = self.cache['interface_names'][ifname]
|
||||
del self.cache['interfaces'][iface.sw_if_index]
|
||||
if len(self.cache['interface_addresses'][iface.sw_if_index]) > 0:
|
||||
self.logger.warning("Not all addresses were removed on %s" % ifname)
|
||||
del self.config['interface_addresses'][iface.sw_if_index]
|
||||
del self.config['interface_names'][ifname]
|
||||
del self.cache['interface_addresses'][iface.sw_if_index]
|
||||
del self.cache['interface_names'][ifname]
|
||||
|
||||
## Use my_dict.pop('key', None), as it allows 'key' to be absent
|
||||
if iface.sw_if_index in self.config['bondethernet_members']:
|
||||
if len(self.config['bondethernet_members'][iface.sw_if_index]) != 0:
|
||||
self.logger.warning("When removing BondEthernet %s, its members are not empty: %s" % (ifname, self.config['bondethernet_members'][iface.sw_if_index]))
|
||||
if iface.sw_if_index in self.cache['bondethernet_members']:
|
||||
if len(self.cache['bondethernet_members'][iface.sw_if_index]) != 0:
|
||||
self.logger.warning("When removing BondEthernet %s, its members are not empty: %s" % (ifname, self.cache['bondethernet_members'][iface.sw_if_index]))
|
||||
else:
|
||||
del self.config['bondethernet_members'][iface.sw_if_index]
|
||||
self.config['bondethernets'].pop(iface.sw_if_index, None)
|
||||
del self.cache['bondethernet_members'][iface.sw_if_index]
|
||||
self.cache['bondethernets'].pop(iface.sw_if_index, None)
|
||||
return True
|
||||
|
||||
def readconfig(self):
|
||||
@ -142,7 +142,7 @@ class VPPApi():
|
||||
self.logger.error("Could not connect to VPP")
|
||||
return False
|
||||
|
||||
self.config_read = False
|
||||
self.cache_read = False
|
||||
|
||||
## Workaround LCPng and linux-cp, in order.
|
||||
self.lcp_enabled = False
|
||||
@ -152,7 +152,7 @@ class VPPApi():
|
||||
r = self.vpp.api.lcpng_itf_pair_get()
|
||||
if isinstance(r, tuple) and r[0].retval == 0:
|
||||
for lcp in r[1]:
|
||||
self.config['lcps'][lcp.phy_sw_if_index] = lcp
|
||||
self.cache['lcps'][lcp.phy_sw_if_index] = lcp
|
||||
self.lcp_enabled = True
|
||||
except:
|
||||
self.logger.warning("lcpng not found, trying linux-cp")
|
||||
@ -162,7 +162,7 @@ class VPPApi():
|
||||
r = self.vpp.api.lcp_itf_pair_get()
|
||||
if isinstance(r, tuple) and r[0].retval == 0:
|
||||
for lcp in r[1]:
|
||||
self.config['lcps'][lcp.phy_sw_if_index] = lcp
|
||||
self.cache['lcps'][lcp.phy_sw_if_index] = lcp
|
||||
self.lcp_enabled = True
|
||||
except:
|
||||
pass
|
||||
@ -173,43 +173,43 @@ class VPPApi():
|
||||
self.logger.debug("Retrieving interfaces")
|
||||
r = self.vpp.api.sw_interface_dump()
|
||||
for iface in r:
|
||||
self.config['interfaces'][iface.sw_if_index] = iface
|
||||
self.config['interface_names'][iface.interface_name] = iface
|
||||
self.config['interface_addresses'][iface.sw_if_index] = []
|
||||
self.cache['interfaces'][iface.sw_if_index] = iface
|
||||
self.cache['interface_names'][iface.interface_name] = iface
|
||||
self.cache['interface_addresses'][iface.sw_if_index] = []
|
||||
self.logger.debug("Retrieving IPv4 addresses for %s" % iface.interface_name)
|
||||
ipr = self.vpp.api.ip_address_dump(sw_if_index=iface.sw_if_index, is_ipv6=False)
|
||||
for ip in ipr:
|
||||
self.config['interface_addresses'][iface.sw_if_index].append(str(ip.prefix))
|
||||
self.cache['interface_addresses'][iface.sw_if_index].append(str(ip.prefix))
|
||||
self.logger.debug("Retrieving IPv6 addresses for %s" % iface.interface_name)
|
||||
ipr = self.vpp.api.ip_address_dump(sw_if_index=iface.sw_if_index, is_ipv6=True)
|
||||
for ip in ipr:
|
||||
self.config['interface_addresses'][iface.sw_if_index].append(str(ip.prefix))
|
||||
self.cache['interface_addresses'][iface.sw_if_index].append(str(ip.prefix))
|
||||
|
||||
self.logger.debug("Retrieving bondethernets")
|
||||
r = self.vpp.api.sw_bond_interface_dump()
|
||||
for iface in r:
|
||||
self.config['bondethernets'][iface.sw_if_index] = iface
|
||||
self.config['bondethernet_members'][iface.sw_if_index] = []
|
||||
self.cache['bondethernets'][iface.sw_if_index] = iface
|
||||
self.cache['bondethernet_members'][iface.sw_if_index] = []
|
||||
for member in self.vpp.api.sw_member_interface_dump(sw_if_index=iface.sw_if_index):
|
||||
self.config['bondethernet_members'][iface.sw_if_index].append(member.sw_if_index)
|
||||
self.cache['bondethernet_members'][iface.sw_if_index].append(member.sw_if_index)
|
||||
|
||||
self.logger.debug("Retrieving bridgedomains")
|
||||
r = self.vpp.api.bridge_domain_dump()
|
||||
for bridge in r:
|
||||
self.config['bridgedomains'][bridge.bd_id] = bridge
|
||||
self.cache['bridgedomains'][bridge.bd_id] = bridge
|
||||
|
||||
self.logger.debug("Retrieving vxlan_tunnels")
|
||||
r = self.vpp.api.vxlan_tunnel_v2_dump()
|
||||
for vxlan in r:
|
||||
self.config['vxlan_tunnels'][vxlan.sw_if_index] = vxlan
|
||||
self.cache['vxlan_tunnels'][vxlan.sw_if_index] = vxlan
|
||||
|
||||
self.logger.debug("Retrieving L2 Cross Connects")
|
||||
r = self.vpp.api.l2_xconnect_dump()
|
||||
for l2xc in r:
|
||||
self.config['l2xcs'][l2xc.rx_sw_if_index] = l2xc
|
||||
self.cache['l2xcs'][l2xc.rx_sw_if_index] = l2xc
|
||||
|
||||
self.config_read = True
|
||||
return self.config_read
|
||||
self.cache_read = True
|
||||
return self.cache_read
|
||||
|
||||
def get_encapsulation(self, iface):
|
||||
""" Return a string with the encapsulation of a subint """
|
||||
@ -228,7 +228,7 @@ class VPPApi():
|
||||
in VPP. Return False otherwise."""
|
||||
ret = True
|
||||
for ifname in ifname_list:
|
||||
if not ifname in self.config['interface_names']:
|
||||
if not ifname in self.cache['interface_names']:
|
||||
self.logger.warning("Interface %s does not exist in VPP" % ifname)
|
||||
ret = False
|
||||
return ret
|
||||
@ -240,35 +240,35 @@ class VPPApi():
|
||||
self.dump_subints()
|
||||
|
||||
def get_sub_interfaces(self):
|
||||
subints = [self.config['interfaces'][x].interface_name for x in self.config['interfaces'] if self.config['interfaces'][x].sub_id>0 and self.config['interfaces'][x].sub_number_of_tags > 0]
|
||||
subints = [self.cache['interfaces'][x].interface_name for x in self.cache['interfaces'] if self.cache['interfaces'][x].sub_id>0 and self.cache['interfaces'][x].sub_number_of_tags > 0]
|
||||
return subints
|
||||
|
||||
def get_qinx_interfaces(self):
|
||||
qinx_subints = [self.config['interfaces'][x].interface_name for x in self.config['interfaces'] if self.config['interfaces'][x].sub_id>0 and self.config['interfaces'][x].sub_inner_vlan_id>0]
|
||||
qinx_subints = [self.cache['interfaces'][x].interface_name for x in self.cache['interfaces'] if self.cache['interfaces'][x].sub_id>0 and self.cache['interfaces'][x].sub_inner_vlan_id>0]
|
||||
return qinx_subints
|
||||
|
||||
def get_dot1x_interfaces(self):
|
||||
dot1x_subints = [self.config['interfaces'][x].interface_name for x in self.config['interfaces'] if self.config['interfaces'][x].sub_id>0 and self.config['interfaces'][x].sub_inner_vlan_id==0]
|
||||
dot1x_subints = [self.cache['interfaces'][x].interface_name for x in self.cache['interfaces'] if self.cache['interfaces'][x].sub_id>0 and self.cache['interfaces'][x].sub_inner_vlan_id==0]
|
||||
return dot1x_subints
|
||||
|
||||
def get_loopbacks(self):
|
||||
loopbacks = [self.config['interfaces'][x].interface_name for x in self.config['interfaces'] if self.config['interfaces'][x].interface_dev_type=='Loopback']
|
||||
loopbacks = [self.cache['interfaces'][x].interface_name for x in self.cache['interfaces'] if self.cache['interfaces'][x].interface_dev_type=='Loopback']
|
||||
return loopbacks
|
||||
|
||||
def get_phys(self):
|
||||
phys = [self.config['interfaces'][x].interface_name for x in self.config['interfaces'] if self.config['interfaces'][x].sw_if_index == self.config['interfaces'][x].sup_sw_if_index and self.config['interfaces'][x].interface_dev_type not in ['virtio', 'BVI', 'Loopback', 'VXLAN', 'local', 'bond']]
|
||||
phys = [self.cache['interfaces'][x].interface_name for x in self.cache['interfaces'] if self.cache['interfaces'][x].sw_if_index == self.cache['interfaces'][x].sup_sw_if_index and self.cache['interfaces'][x].interface_dev_type not in ['virtio', 'BVI', 'Loopback', 'VXLAN', 'local', 'bond']]
|
||||
return phys
|
||||
|
||||
def get_bondethernets(self):
|
||||
bonds = [self.config['bondethernets'][x].interface_name for x in self.config['bondethernets']]
|
||||
bonds = [self.cache['bondethernets'][x].interface_name for x in self.cache['bondethernets']]
|
||||
return bonds
|
||||
|
||||
def get_vxlan_tunnels(self):
|
||||
vxlan_tunnels = [self.config['interfaces'][x].interface_name for x in self.config['interfaces'] if self.config['interfaces'][x].interface_dev_type in ['VXLAN']]
|
||||
vxlan_tunnels = [self.cache['interfaces'][x].interface_name for x in self.cache['interfaces'] if self.cache['interfaces'][x].interface_dev_type in ['VXLAN']]
|
||||
return vxlan_tunnels
|
||||
|
||||
def get_lcp_by_interface(self, sw_if_index):
|
||||
for idx, lcp in self.config['lcps'].items():
|
||||
for idx, lcp in self.cache['lcps'].items():
|
||||
if lcp.phy_sw_if_index == sw_if_index:
|
||||
return lcp
|
||||
return None
|
||||
@ -276,65 +276,65 @@ class VPPApi():
|
||||
def dump_phys(self):
|
||||
phys = self.get_phys()
|
||||
for ifname in phys:
|
||||
iface = self.config['interface_names'][ifname]
|
||||
iface = self.cache['interface_names'][ifname]
|
||||
self.logger.info("%s idx=%d" % (iface.interface_name, iface.sw_if_index))
|
||||
|
||||
def dump_subints(self):
|
||||
self.logger.info("*** QinX ***")
|
||||
subints = self.get_qinx_interfaces()
|
||||
for ifname in subints:
|
||||
iface = self.config['interface_names'][ifname]
|
||||
iface = self.cache['interface_names'][ifname]
|
||||
self.logger.info("%s idx=%d encap=%s" % (iface.interface_name, iface.sw_if_index, self.get_encapsulation(iface)))
|
||||
|
||||
self.logger.info("*** .1q/.1ad ***")
|
||||
subints = self.get_dot1x_interfaces()
|
||||
for ifname in subints:
|
||||
iface = self.config['interface_names'][ifname]
|
||||
iface = self.cache['interface_names'][ifname]
|
||||
self.logger.info("%s idx=%d encap=%s" % (iface.interface_name, iface.sw_if_index, self.get_encapsulation(iface)))
|
||||
|
||||
def dump_bridgedomains(self):
|
||||
for bd_id, bridge in self.config['bridgedomains'].items():
|
||||
for bd_id, bridge in self.cache['bridgedomains'].items():
|
||||
self.logger.info("BridgeDomain%d" % (bridge.bd_id))
|
||||
if bridge.bvi_sw_if_index > 0 and bridge.bvi_sw_if_index < 2**32-1 :
|
||||
self.logger.info(" BVI: " + self.config['interfaces'][bridge.bvi_sw_if_index].interface_name)
|
||||
self.logger.info(" BVI: " + self.cache['interfaces'][bridge.bvi_sw_if_index].interface_name)
|
||||
|
||||
members = []
|
||||
for member in bridge.sw_if_details:
|
||||
members.append(self.config['interfaces'][member.sw_if_index].interface_name)
|
||||
members.append(self.cache['interfaces'][member.sw_if_index].interface_name)
|
||||
if len(members) > 0:
|
||||
self.logger.info(" Members: " + ' '.join(members))
|
||||
|
||||
def dump_interfaces(self):
|
||||
for idx, iface in self.config['interfaces'].items():
|
||||
for idx, iface in self.cache['interfaces'].items():
|
||||
self.logger.info("%s idx=%d type=%s mac=%s mtu=%d flags=%d" % (iface.interface_name,
|
||||
iface.sw_if_index, iface.interface_dev_type, iface.l2_address,
|
||||
iface.mtu[0], iface.flags))
|
||||
|
||||
if iface.interface_dev_type=='bond' and iface.sub_id == 0 and iface.sw_if_index in self.config['bondethernet_members']:
|
||||
members = [self.config['interfaces'][x].interface_name for x in self.config['bondethernet_members'][iface.sw_if_index]]
|
||||
if iface.interface_dev_type=='bond' and iface.sub_id == 0 and iface.sw_if_index in self.cache['bondethernet_members']:
|
||||
members = [self.cache['interfaces'][x].interface_name for x in self.cache['bondethernet_members'][iface.sw_if_index]]
|
||||
self.logger.info(" Members: %s" % ' '.join(members))
|
||||
if iface.interface_dev_type=="VXLAN":
|
||||
vxlan = self.config['vxlan_tunnels'][iface.sw_if_index]
|
||||
vxlan = self.cache['vxlan_tunnels'][iface.sw_if_index]
|
||||
self.logger.info(" VXLAN: %s:%d -> %s:%d VNI %d" % (vxlan.src_address, vxlan.src_port,
|
||||
vxlan.dst_address, vxlan.dst_port, vxlan.vni))
|
||||
|
||||
if iface.sub_id > 0:
|
||||
self.logger.info(" Encapsulation: %s" % (self.get_encapsulation(iface)))
|
||||
|
||||
if iface.sw_if_index in self.config['lcps']:
|
||||
lcp = self.config['lcps'][iface.sw_if_index]
|
||||
tap_name = self.config['interfaces'][lcp.host_sw_if_index].interface_name
|
||||
if iface.sw_if_index in self.cache['lcps']:
|
||||
lcp = self.cache['lcps'][iface.sw_if_index]
|
||||
tap_name = self.cache['interfaces'][lcp.host_sw_if_index].interface_name
|
||||
tap_idx = lcp.host_sw_if_index
|
||||
self.logger.info(" TAP: %s (tap=%s idx=%d)" % (lcp.host_if_name, tap_name, tap_idx))
|
||||
|
||||
if len(self.config['interface_addresses'][iface.sw_if_index])>0:
|
||||
self.logger.info(" L3: %s" % ' '.join(self.config['interface_addresses'][iface.sw_if_index]))
|
||||
if len(self.cache['interface_addresses'][iface.sw_if_index])>0:
|
||||
self.logger.info(" L3: %s" % ' '.join(self.cache['interface_addresses'][iface.sw_if_index]))
|
||||
|
||||
if iface.sw_if_index in self.config['l2xcs']:
|
||||
l2xc = self.config['l2xcs'][iface.sw_if_index]
|
||||
self.logger.info(" L2XC: %s" % self.config['interfaces'][l2xc.tx_sw_if_index].interface_name)
|
||||
if iface.sw_if_index in self.cache['l2xcs']:
|
||||
l2xc = self.cache['l2xcs'][iface.sw_if_index]
|
||||
self.logger.info(" L2XC: %s" % self.cache['interfaces'][l2xc.tx_sw_if_index].interface_name)
|
||||
|
||||
for bd_id, bridge in self.config['bridgedomains'].items():
|
||||
for bd_id, bridge in self.cache['bridgedomains'].items():
|
||||
if bridge.bvi_sw_if_index == iface.sw_if_index:
|
||||
self.logger.info(" BVI: BridgeDomain%d" % (bd_id))
|
||||
|
||||
|
Reference in New Issue
Block a user