Merge "Add device profile to `port
`"
This commit is contained in:
commit
01a53fa96f
@ -38,7 +38,7 @@ msgpack-python==0.4.0
|
|||||||
munch==2.1.0
|
munch==2.1.0
|
||||||
netaddr==0.7.18
|
netaddr==0.7.18
|
||||||
netifaces==0.10.4
|
netifaces==0.10.4
|
||||||
openstacksdk==0.52.0
|
openstacksdk==0.53.0
|
||||||
os-client-config==2.1.0
|
os-client-config==2.1.0
|
||||||
os-service-types==1.7.0
|
os-service-types==1.7.0
|
||||||
os-testr==1.0.0
|
os-testr==1.0.0
|
||||||
|
@ -168,6 +168,9 @@ def _get_attrs(client_manager, parsed_args):
|
|||||||
parsed_args.numa_policy_legacy):
|
parsed_args.numa_policy_legacy):
|
||||||
attrs['numa_affinity_policy'] = 'legacy'
|
attrs['numa_affinity_policy'] = 'legacy'
|
||||||
|
|
||||||
|
if 'device_profile' in parsed_args and parsed_args.device_profile:
|
||||||
|
attrs['device_profile'] = parsed_args.device_profile
|
||||||
|
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
|
|
||||||
@ -443,6 +446,11 @@ class CreatePort(command.ShowOne):
|
|||||||
"ip-address=<ip-address>[,mac-address=<mac-address>] "
|
"ip-address=<ip-address>[,mac-address=<mac-address>] "
|
||||||
"(repeat option to set multiple allowed-address pairs)")
|
"(repeat option to set multiple allowed-address pairs)")
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--device-profile',
|
||||||
|
metavar='<device-profile>',
|
||||||
|
help=_('Cyborg port device profile')
|
||||||
|
)
|
||||||
_tag.add_tag_option_to_parser_for_create(parser, _('port'))
|
_tag.add_tag_option_to_parser_for_create(parser, _('port'))
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
@ -697,6 +697,7 @@ class FakePort(object):
|
|||||||
'description': 'description-' + uuid.uuid4().hex,
|
'description': 'description-' + uuid.uuid4().hex,
|
||||||
'device_id': 'device-id-' + uuid.uuid4().hex,
|
'device_id': 'device-id-' + uuid.uuid4().hex,
|
||||||
'device_owner': 'compute:nova',
|
'device_owner': 'compute:nova',
|
||||||
|
'device_profile': 'cyborg_device_profile_1',
|
||||||
'dns_assignment': [{}],
|
'dns_assignment': [{}],
|
||||||
'dns_domain': 'dns-domain-' + uuid.uuid4().hex,
|
'dns_domain': 'dns-domain-' + uuid.uuid4().hex,
|
||||||
'dns_name': 'dns-name-' + uuid.uuid4().hex,
|
'dns_name': 'dns-name-' + uuid.uuid4().hex,
|
||||||
|
@ -54,6 +54,7 @@ class TestPort(network_fakes.TestNetworkV2):
|
|||||||
'description',
|
'description',
|
||||||
'device_id',
|
'device_id',
|
||||||
'device_owner',
|
'device_owner',
|
||||||
|
'device_profile',
|
||||||
'dns_assignment',
|
'dns_assignment',
|
||||||
'dns_domain',
|
'dns_domain',
|
||||||
'dns_name',
|
'dns_name',
|
||||||
@ -86,6 +87,7 @@ class TestPort(network_fakes.TestNetworkV2):
|
|||||||
fake_port.description,
|
fake_port.description,
|
||||||
fake_port.device_id,
|
fake_port.device_id,
|
||||||
fake_port.device_owner,
|
fake_port.device_owner,
|
||||||
|
fake_port.device_profile,
|
||||||
format_columns.ListDictColumn(fake_port.dns_assignment),
|
format_columns.ListDictColumn(fake_port.dns_assignment),
|
||||||
fake_port.dns_domain,
|
fake_port.dns_domain,
|
||||||
fake_port.dns_name,
|
fake_port.dns_name,
|
||||||
@ -737,6 +739,33 @@ class TestCreatePort(TestPort):
|
|||||||
def test_create_with_numa_affinity_policy_null(self):
|
def test_create_with_numa_affinity_policy_null(self):
|
||||||
self._test_create_with_numa_affinity_policy()
|
self._test_create_with_numa_affinity_policy()
|
||||||
|
|
||||||
|
def test_create_with_device_profile(self):
|
||||||
|
arglist = [
|
||||||
|
'--network', self._port.network_id,
|
||||||
|
'--device-profile', 'cyborg_device_profile_1',
|
||||||
|
'test-port',
|
||||||
|
]
|
||||||
|
|
||||||
|
verifylist = [
|
||||||
|
('network', self._port.network_id,),
|
||||||
|
('device_profile', self._port.device_profile,),
|
||||||
|
('name', 'test-port'),
|
||||||
|
]
|
||||||
|
|
||||||
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
|
columns, data = (self.cmd.take_action(parsed_args))
|
||||||
|
|
||||||
|
create_args = {
|
||||||
|
'admin_state_up': True,
|
||||||
|
'network_id': self._port.network_id,
|
||||||
|
'name': 'test-port',
|
||||||
|
'device_profile': 'cyborg_device_profile_1',
|
||||||
|
}
|
||||||
|
self.network.create_port.assert_called_once_with(**create_args)
|
||||||
|
self.assertEqual(self.columns, columns)
|
||||||
|
self.assertItemsEqual(self.data, data)
|
||||||
|
|
||||||
|
|
||||||
class TestDeletePort(TestPort):
|
class TestDeletePort(TestPort):
|
||||||
|
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Add device profile to ``port create`` command.
|
@ -5,7 +5,7 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
|||||||
|
|
||||||
cliff>=3.5.0 # Apache-2.0
|
cliff>=3.5.0 # Apache-2.0
|
||||||
iso8601>=0.1.11 # MIT
|
iso8601>=0.1.11 # MIT
|
||||||
openstacksdk>=0.52.0 # Apache-2.0
|
openstacksdk>=0.53.0 # Apache-2.0
|
||||||
osc-lib>=2.3.0 # Apache-2.0
|
osc-lib>=2.3.0 # Apache-2.0
|
||||||
oslo.i18n>=3.15.3 # Apache-2.0
|
oslo.i18n>=3.15.3 # Apache-2.0
|
||||||
python-keystoneclient>=3.22.0 # Apache-2.0
|
python-keystoneclient>=3.22.0 # Apache-2.0
|
||||||
|
Loading…
Reference in New Issue
Block a user