Skip to content

Commit

Permalink
Merge pull request #92 from arista-eosplus/mlag_fix
Browse files Browse the repository at this point in the history
Handle any full string in mlag domain-id, including dot, hyphen, and space
  • Loading branch information
grybak-arista committed Mar 28, 2016
2 parents 69959ad + 634131e commit edb076a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pyeapi/api/mlag.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _parse_domain_id(self, config):
dict: A dict object that is intended to be merged into the
resource dict
"""
match = re.search(r'domain-id (\w+)', config)
match = re.search(r'domain-id (.+)$', config)
value = match.group(1) if match else None
return dict(domain_id=value)

Expand Down
7 changes: 4 additions & 3 deletions test/system/test_api_mlag.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ def test_set_domain_id_with_value(self):
dut.config('default mlag configuration')
api = dut.api('mlag')
self.assertIn('no domain-id', api.get_block('mlag configuration'))
result = dut.api('mlag').set_domain_id('test')
self.assertTrue(result)
self.assertIn('domain-id test', api.get_block('mlag configuration'))
for domid in ['test_domain_id', 'test.dom-id', 'test domain id']:
result = dut.api('mlag').set_domain_id(domid)
self.assertTrue(result)
self.assertIn('domain-id %s' % domid, api.get_block('mlag configuration'))

def test_set_domain_id_with_no_value(self):
for dut in self.duts:
Expand Down
4 changes: 2 additions & 2 deletions test/unit/test_api_mlag.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def test_set_domain_id(self):
for state in ['config', 'negate', 'default']:
cmds = ['mlag configuration']
if state == 'config':
cmds.append('domain-id test')
func = function('set_domain_id', 'test')
cmds.append('domain-id test.dom-id string')
func = function('set_domain_id', 'test.dom-id string')
elif state == 'negate':
cmds.append('no domain-id')
func = function('set_domain_id', value='test', disable=True)
Expand Down

0 comments on commit edb076a

Please sign in to comment.