Merge "Replace hardcoded port name generation with function"
This commit is contained in:
commit
f8a30cc5b1
@ -244,7 +244,7 @@ def _create_subnets_and_or_port(interface, neutron_network_id, endpoint_id):
|
||||
|
||||
try:
|
||||
port = {
|
||||
'name': '-'.join([endpoint_id, 'port']),
|
||||
'name': utils.get_neutron_port_name(endpoint_id),
|
||||
'admin_state_up': True,
|
||||
'network_id': neutron_network_id,
|
||||
'device_owner': constants.DEVICE_OWNER,
|
||||
@ -723,7 +723,7 @@ def network_driver_leave():
|
||||
.format(neutron_network_name)
|
||||
})
|
||||
else:
|
||||
neutron_port_name = '-'.join([endpoint_id, 'port'])
|
||||
neutron_port_name = utils.get_neutron_port_name(endpoint_id)
|
||||
filtered_ports = _get_ports_by_attrs(name=neutron_port_name)
|
||||
if not filtered_ports:
|
||||
raise exceptions.NoResourceException(
|
||||
|
@ -14,6 +14,7 @@ from neutronclient.tests.unit import test_cli20
|
||||
|
||||
from kuryr import app
|
||||
from kuryr import binding
|
||||
from kuryr import utils
|
||||
|
||||
|
||||
class TestCase(test_cli20.CLITestV20Base):
|
||||
@ -165,7 +166,7 @@ class TestKuryrBase(TestCase):
|
||||
fake_port = {
|
||||
'port': {
|
||||
"status": "DOWN",
|
||||
"name": '-'.join([docker_endpoint_id, '0', 'port']),
|
||||
"name": utils.get_neutron_port_name(docker_endpoint_id),
|
||||
"allowed_address_pairs": [],
|
||||
"admin_state_up": True,
|
||||
"network_id": neutron_network_id,
|
||||
|
@ -177,7 +177,7 @@ class TestKuryr(base.TestKuryrBase):
|
||||
fake_neutron_port_id = str(uuid.uuid4())
|
||||
fake_port_request = {
|
||||
'port': {
|
||||
'name': '-'.join([docker_endpoint_id, 'port']),
|
||||
'name': utils.get_neutron_port_name(docker_endpoint_id),
|
||||
'admin_state_up': True,
|
||||
'mac_address': fake_mac_address,
|
||||
'network_id': fake_neutron_network_id,
|
||||
@ -286,7 +286,7 @@ class TestKuryr(base.TestKuryrBase):
|
||||
fake_neutron_port_id = str(uuid.uuid4())
|
||||
fake_port_request = {
|
||||
'port': {
|
||||
'name': '-'.join([docker_endpoint_id, 'port']),
|
||||
'name': utils.get_neutron_port_name(docker_endpoint_id),
|
||||
'admin_state_up': True,
|
||||
'mac_address': fake_mac_address,
|
||||
'network_id': fake_neutron_network_id,
|
||||
@ -396,7 +396,7 @@ class TestKuryr(base.TestKuryrBase):
|
||||
self.mox.StubOutWithMock(app.neutron, 'create_port')
|
||||
fake_port_request = {
|
||||
'port': {
|
||||
'name': '-'.join([docker_endpoint_id, 'port']),
|
||||
'name': utils.get_neutron_port_name(docker_endpoint_id),
|
||||
'admin_state_up': True,
|
||||
'device_owner': constants.DEVICE_OWNER,
|
||||
'device_id': docker_endpoint_id,
|
||||
|
@ -21,6 +21,7 @@ from oslo_serialization import jsonutils
|
||||
from kuryr import app
|
||||
from kuryr.common import constants
|
||||
from kuryr.tests import base
|
||||
from kuryr import utils
|
||||
|
||||
|
||||
class TestKuryrEndpointFailures(base.TestKuryrFailures):
|
||||
@ -85,7 +86,7 @@ class TestKuryrEndpointFailures(base.TestKuryrFailures):
|
||||
self.mox.StubOutWithMock(app.neutron, 'create_port')
|
||||
fake_port_request = {
|
||||
'port': {
|
||||
'name': '-'.join([docker_endpoint_id, 'port']),
|
||||
'name': utils.get_neutron_port_name(docker_endpoint_id),
|
||||
'admin_state_up': True,
|
||||
'device_owner': constants.DEVICE_OWNER,
|
||||
'device_id': docker_endpoint_id,
|
||||
@ -105,7 +106,7 @@ class TestKuryrEndpointFailures(base.TestKuryrFailures):
|
||||
fake_port = {
|
||||
"port": {
|
||||
"status": "DOWN",
|
||||
"name": '-'.join([docker_endpoint_id, 'port']),
|
||||
"name": utils.get_neutron_port_name(docker_endpoint_id),
|
||||
"allowed_address_pairs": [],
|
||||
"admin_state_up": True,
|
||||
"network_id": neutron_network_id,
|
||||
|
Loading…
Reference in New Issue
Block a user