Handle new baremetal format of port-id field
Ironic/Baremetal will learn the port id via LLDP. As a result, the format of this field can be different than what is received today. Currently ML2 Nexus code expects ethernet:n/m or just n/m. Baremetal port-id format instead is Ethernet n/m or Ethernetn/m. This port-id is converted to all lowercase and whitespace is removed to provide internal uniformity in this field and to minimize output variation in unit tests. During the split of internal interface name, the interface type results in ethernet and port is n/m which is consistent results with current ethernet formats. Change-Id: Ifb9d6dbae00b510b95017e6fd0a1e4720b875ceb Closes-bug: #1544301
This commit is contained in:
parent
d3cedbd7b9
commit
88e7ef2e88
|
@ -322,11 +322,15 @@ class CiscoNexusMechanismDriver(api.MechanismDriver):
|
|||
:returns: returns suffix to interface name
|
||||
"""
|
||||
|
||||
interface = interface.lower()
|
||||
if ch_grp != 0:
|
||||
intf_type = 'port-channel'
|
||||
port = str(ch_grp)
|
||||
elif ':' in interface:
|
||||
intf_type, port = interface.split(':')
|
||||
elif interface.startswith('ethernet'):
|
||||
interface = interface.replace(" ", "")
|
||||
_, intf_type, port = interface.partition('ethernet')
|
||||
else:
|
||||
intf_type, port = 'ethernet', interface
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ INSTANCE_2 = 'testvm2'
|
|||
INSTANCE_PC = 'testpcvm'
|
||||
INSTANCE_DUAL = 'testdualvm'
|
||||
|
||||
NEXUS_BAREMETAL_PORT_1 = 'Ethernet 1/10'
|
||||
NEXUS_PORT_1 = 'ethernet:1/10'
|
||||
NEXUS_PORT_2 = 'ethernet:1/20'
|
||||
NEXUS_DUAL1 = 'ethernet:1/3'
|
||||
|
|
|
@ -388,7 +388,7 @@ class TestCiscoNexusBaremetalDevice(test_cisco_nexus_base.TestCiscoNexusBase):
|
|||
baremetal_profile = {
|
||||
"local_link_information": [
|
||||
{
|
||||
"port_id": test_cisco_nexus_base.NEXUS_PORT_1,
|
||||
"port_id": test_cisco_nexus_base.NEXUS_BAREMETAL_PORT_1,
|
||||
"switch_info": {
|
||||
"is_native": False,
|
||||
"switch_ip": test_cisco_nexus_base.NEXUS_IP_ADDRESS_1,
|
||||
|
@ -400,7 +400,7 @@ class TestCiscoNexusBaremetalDevice(test_cisco_nexus_base.TestCiscoNexusBase):
|
|||
baremetal_profile_is_native = {
|
||||
"local_link_information": [
|
||||
{
|
||||
"port_id": test_cisco_nexus_base.NEXUS_PORT_1,
|
||||
"port_id": test_cisco_nexus_base.NEXUS_BAREMETAL_PORT_1,
|
||||
"switch_info": {
|
||||
"is_native": True,
|
||||
"switch_ip": test_cisco_nexus_base.NEXUS_IP_ADDRESS_1,
|
||||
|
@ -418,7 +418,7 @@ class TestCiscoNexusBaremetalDevice(test_cisco_nexus_base.TestCiscoNexusBase):
|
|||
test_cisco_nexus_base.TestCiscoNexusBase.TestConfigObj(
|
||||
test_cisco_nexus_base.NEXUS_IP_ADDRESS_1,
|
||||
test_cisco_nexus_base.HOST_NAME_UNUSED,
|
||||
test_cisco_nexus_base.NEXUS_PORT_1,
|
||||
test_cisco_nexus_base.NEXUS_BAREMETAL_PORT_1,
|
||||
test_cisco_nexus_base.INSTANCE_1,
|
||||
test_cisco_nexus_base.VLAN_ID_1,
|
||||
test_cisco_nexus_base.NO_VXLAN_ID,
|
||||
|
@ -430,7 +430,7 @@ class TestCiscoNexusBaremetalDevice(test_cisco_nexus_base.TestCiscoNexusBase):
|
|||
test_cisco_nexus_base.TestCiscoNexusBase.TestConfigObj(
|
||||
test_cisco_nexus_base.NEXUS_IP_ADDRESS_1,
|
||||
test_cisco_nexus_base.HOST_NAME_UNUSED,
|
||||
test_cisco_nexus_base.NEXUS_PORT_1,
|
||||
test_cisco_nexus_base.NEXUS_BAREMETAL_PORT_1,
|
||||
test_cisco_nexus_base.INSTANCE_1,
|
||||
test_cisco_nexus_base.VLAN_ID_2,
|
||||
test_cisco_nexus_base.NO_VXLAN_ID,
|
||||
|
@ -544,7 +544,7 @@ class TestCiscoNexusBaremetalDevice(test_cisco_nexus_base.TestCiscoNexusBase):
|
|||
"local_link_information": [
|
||||
# This IP is configured at init time
|
||||
{
|
||||
"port_id": test_cisco_nexus_base.NEXUS_PORT_1,
|
||||
"port_id": test_cisco_nexus_base.NEXUS_BAREMETAL_PORT_1,
|
||||
"switch_info": {
|
||||
"is_native": False,
|
||||
"switch_ip": "1.1.1.1",
|
||||
|
@ -552,7 +552,7 @@ class TestCiscoNexusBaremetalDevice(test_cisco_nexus_base.TestCiscoNexusBase):
|
|||
},
|
||||
# This IP not configured at init time
|
||||
{
|
||||
"port_id": test_cisco_nexus_base.NEXUS_PORT_1,
|
||||
"port_id": test_cisco_nexus_base.NEXUS_BAREMETAL_PORT_1,
|
||||
"switch_info": {
|
||||
"is_native": False,
|
||||
"switch_ip": "6.6.6.6",
|
||||
|
@ -566,7 +566,7 @@ class TestCiscoNexusBaremetalDevice(test_cisco_nexus_base.TestCiscoNexusBase):
|
|||
test_cisco_nexus_base.TestCiscoNexusBase.TestConfigObj(
|
||||
test_cisco_nexus_base.NEXUS_IP_ADDRESS_1,
|
||||
test_cisco_nexus_base.HOST_NAME_UNUSED,
|
||||
test_cisco_nexus_base.NEXUS_PORT_1,
|
||||
test_cisco_nexus_base.NEXUS_BAREMETAL_PORT_1,
|
||||
test_cisco_nexus_base.INSTANCE_1,
|
||||
test_cisco_nexus_base.VLAN_ID_1,
|
||||
test_cisco_nexus_base.NO_VXLAN_ID,
|
||||
|
|
|
@ -834,7 +834,7 @@ class TestCiscoNexusBaremetalReplay(
|
|||
baremetal_profile = {
|
||||
"local_link_information": [
|
||||
{
|
||||
"port_id": test_cisco_nexus_base.NEXUS_PORT_1,
|
||||
"port_id": test_cisco_nexus_base.NEXUS_BAREMETAL_PORT_1,
|
||||
"switch_info": {
|
||||
"is_native": False,
|
||||
"switch_ip": test_cisco_nexus_base.NEXUS_IP_ADDRESS_1,
|
||||
|
@ -846,7 +846,7 @@ class TestCiscoNexusBaremetalReplay(
|
|||
baremetal_profile_is_native = {
|
||||
"local_link_information": [
|
||||
{
|
||||
"port_id": test_cisco_nexus_base.NEXUS_PORT_1,
|
||||
"port_id": test_cisco_nexus_base.NEXUS_BAREMETAL_PORT_1,
|
||||
"switch_info": {
|
||||
"is_native": True,
|
||||
"switch_ip": test_cisco_nexus_base.NEXUS_IP_ADDRESS_1,
|
||||
|
@ -860,7 +860,7 @@ class TestCiscoNexusBaremetalReplay(
|
|||
test_cisco_nexus_base.TestCiscoNexusBase.TestConfigObj(
|
||||
test_cisco_nexus_base.NEXUS_IP_ADDRESS_1,
|
||||
test_cisco_nexus_base.HOST_NAME_UNUSED,
|
||||
test_cisco_nexus_base.NEXUS_PORT_1,
|
||||
test_cisco_nexus_base.NEXUS_BAREMETAL_PORT_1,
|
||||
test_cisco_nexus_base.INSTANCE_1,
|
||||
test_cisco_nexus_base.VLAN_ID_1,
|
||||
test_cisco_nexus_base.NO_VXLAN_ID,
|
||||
|
@ -872,7 +872,7 @@ class TestCiscoNexusBaremetalReplay(
|
|||
test_cisco_nexus_base.TestCiscoNexusBase.TestConfigObj(
|
||||
test_cisco_nexus_base.NEXUS_IP_ADDRESS_1,
|
||||
test_cisco_nexus_base.HOST_NAME_UNUSED,
|
||||
test_cisco_nexus_base.NEXUS_PORT_1,
|
||||
test_cisco_nexus_base.NEXUS_BAREMETAL_PORT_1,
|
||||
test_cisco_nexus_base.INSTANCE_2,
|
||||
test_cisco_nexus_base.VLAN_ID_2,
|
||||
test_cisco_nexus_base.NO_VXLAN_ID,
|
||||
|
@ -884,7 +884,7 @@ class TestCiscoNexusBaremetalReplay(
|
|||
test_cisco_nexus_base.TestCiscoNexusBase.TestConfigObj(
|
||||
test_cisco_nexus_base.NEXUS_IP_ADDRESS_1,
|
||||
test_cisco_nexus_base.HOST_NAME_UNUSED,
|
||||
test_cisco_nexus_base.NEXUS_PORT_1,
|
||||
test_cisco_nexus_base.NEXUS_BAREMETAL_PORT_1,
|
||||
test_cisco_nexus_base.INSTANCE_2,
|
||||
test_cisco_nexus_base.VLAN_ID_2,
|
||||
test_cisco_nexus_base.NO_VXLAN_ID,
|
||||
|
|
Loading…
Reference in New Issue