Adding the option to configure disabled mac profile

Change-Id: I43d6a90bbe24443b94602ef8c94162d901bce29e
This commit is contained in:
Adit Sarfaty 2019-05-01 09:24:42 +03:00
parent 85dd63dffa
commit 599e2839c7
2 changed files with 42 additions and 3 deletions

View File

@ -245,6 +245,43 @@ class TestSwitchingProfileTestCase(BaseTestResource):
data=jsonutils.dumps({
'mac_learning': {
'enabled': True,
'unicast_flooding_allowed': True,
},
'resource_type': self.types.MAC_LEARNING,
'display_name': 'plugin-mac-learning',
'description': 'mac-learning-for-plugin',
'tags': tags,
'mac_change_allowed': True,
}, sort_keys=True),
headers=self.default_headers())
def test_create_mac_learning_disabled_profile(self):
tags = [
{
'scope': 'os-project-id',
'tag': 'project-1'
},
{
'scope': 'os-api-version',
'tag': '2.1.1.0'
}
]
mocked_resource = self.get_mocked_resource()
mocked_resource.create_mac_learning_profile(
'plugin-mac-learning', 'mac-learning-for-plugin',
mac_learning_enabled=False,
tags=tags)
test_client.assert_json_call(
'post', mocked_resource,
'https://1.2.3.4/api/v1/switching-profiles',
data=jsonutils.dumps({
'mac_learning': {
'enabled': False,
'unicast_flooding_allowed': False,
},
'resource_type': self.types.MAC_LEARNING,
'display_name': 'plugin-mac-learning',

View File

@ -351,10 +351,12 @@ class NsxLibSwitchingProfile(utils.NsxLibApiBase):
bpdu_filter=bpdu_filter,
block_non_ip_traffic=True)
def create_mac_learning_profile(self, display_name,
description, tags=None):
def create_mac_learning_profile(self, display_name, description,
mac_learning_enabled=True,
tags=None):
mac_learning = {
'enabled': True,
'enabled': mac_learning_enabled,
'unicast_flooding_allowed': mac_learning_enabled
}
return self.create(SwitchingProfileTypes.MAC_LEARNING,
display_name=display_name,