* Create default Vxlan and Vnet configs for ToRs with Appliance Resource type
This commit is contained in:
parent
b0f2cb3be2
commit
b4dcd1bcb4
@ -1255,6 +1255,28 @@ def parse_spine_chassis_fe(results, vni, lo_intfs, phyport_intfs, pc_intfs, pc_m
|
||||
# Enslave the port channel interface to a Vnet
|
||||
pc_intfs[pc_intf] = {'vnet_name': chassis_vnet}
|
||||
|
||||
def parse_default_vxlan_decap(results, vni, lo_intfs):
|
||||
vnet ='Vnet-default'
|
||||
vxlan_tunnel = 'tunnel_v4'
|
||||
|
||||
# Vxlan tunnel information
|
||||
lo_addr = '0.0.0.0'
|
||||
for lo in lo_intfs:
|
||||
lo_network = ipaddress.ip_network(UNICODE_TYPE(lo[1]), False)
|
||||
if lo_network.version == 4:
|
||||
lo_addr = str(lo_network.network_address)
|
||||
break
|
||||
results['VXLAN_TUNNEL'] = {vxlan_tunnel: {
|
||||
'src_ip': lo_addr
|
||||
}}
|
||||
|
||||
# Vnet information
|
||||
results['VNET'] = {vnet: {
|
||||
'vxlan_tunnel': vxlan_tunnel,
|
||||
'scope': "default",
|
||||
'vni': vni
|
||||
}}
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# Post-processing functions
|
||||
@ -1605,9 +1627,10 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
|
||||
for key in voq_inband_intfs:
|
||||
results['VOQ_INBAND_INTERFACE'][key] = voq_inband_intfs[key]
|
||||
|
||||
|
||||
if resource_type is not None:
|
||||
results['DEVICE_METADATA']['localhost']['resource_type'] = resource_type
|
||||
if 'Appliance' in resource_type:
|
||||
parse_default_vxlan_decap(results, vni_default, lo_intfs)
|
||||
|
||||
if downstream_subrole is not None:
|
||||
results['DEVICE_METADATA']['localhost']['downstream_subrole'] = downstream_subrole
|
||||
|
@ -731,6 +731,11 @@
|
||||
<a:Reference i:nil="true"/>
|
||||
<a:Value>2.2.2.2</a:Value>
|
||||
</a:DeviceProperty>
|
||||
<a:DeviceProperty>
|
||||
<a:Name>ResourceType</a:Name>
|
||||
<a:Reference i:nil="true"/>
|
||||
<a:Value>HaAppliance</a:Value>
|
||||
</a:DeviceProperty>
|
||||
</a:Properties>
|
||||
</a:DeviceMetadata>
|
||||
</Devices>
|
||||
|
@ -494,6 +494,22 @@ class TestCfgGen(TestCase):
|
||||
utils.to_dict("{'lanes': '101,102,103,104', 'fec': 'rs', 'pfc_asym': 'off', 'mtu': '9100', 'tpid': '0x8100', 'alias': 'fortyGigE0/124', 'admin_status': 'up', 'speed': '100000', 'description': 'ARISTA04T1:Ethernet1/1'}")
|
||||
)
|
||||
|
||||
def test_minigraph_default_vxlan(self):
|
||||
argument = '-m "' + self.sample_graph_deployment_id + '" -p "' + self.port_config + '" -v "VXLAN_TUNNEL"'
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(
|
||||
utils.to_dict(output.strip()),
|
||||
utils.to_dict("{'tunnel_v4': {'src_ip': '10.1.0.32'}}")
|
||||
)
|
||||
|
||||
def test_minigraph_default_vnet(self):
|
||||
argument = '-m "' + self.sample_graph_deployment_id + '" -p "' + self.port_config + '" -v "VNET"'
|
||||
output = self.run_script(argument)
|
||||
self.assertEqual(
|
||||
utils.to_dict(output.strip()),
|
||||
utils.to_dict("{'Vnet-default': {'vxlan_tunnel': 'tunnel_v4', 'scope': 'default', 'vni': 8000}}")
|
||||
)
|
||||
|
||||
def test_minigraph_bgp(self):
|
||||
argument = '-m "' + self.sample_graph_bgp_speaker + '" -p "' + self.port_config + '" -v "BGP_NEIGHBOR[\'10.0.0.59\']"'
|
||||
output = self.run_script(argument)
|
||||
|
Reference in New Issue
Block a user