Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
Merge e9154cc into 1bc85d0
Browse files Browse the repository at this point in the history
  • Loading branch information
slinksoft committed Oct 15, 2020
2 parents 1bc85d0 + e9154cc commit d8229f5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions kytos/core/config.py
Expand Up @@ -176,6 +176,9 @@ def _parse_options(self, argv):
napps = options.napps_pre_installed
options.napps_pre_installed = json.loads(napps)

if isinstance(options.vlan_pool, str):
options.vlan_pool = json.loads(options.vlan_pool)

return options


Expand Down
2 changes: 1 addition & 1 deletion kytos/core/controller.py
Expand Up @@ -629,7 +629,7 @@ def set_switch_options(self, dpid):

vlan_pool = {}
try:
vlan_pool = json.loads(self.options.vlan_pool)
vlan_pool = self.options.vlan_pool
if not vlan_pool:
return
except (TypeError, json.JSONDecodeError) as err:
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_core/test_switch.py
Expand Up @@ -68,15 +68,15 @@ def tearDown(self):

def test_switch_vlan_pool_default(self):
"""Test default vlan_pool value."""
self.assertEqual(self.options.vlan_pool, '{}')
self.assertEqual(self.options.vlan_pool, {})

def test_switch_vlan_pool_options(self):
"""Test switch with the example from kytos.conf."""
dpid = "00:00:00:00:00:00:00:01"
vlan_pool_json = '{"00:00:00:00:00:00:00:01": ' \
+ '{"1": [[1, 2], [5, 10]], "4": [[3, 4]]}}'
vlan_pool = {"00:00:00:00:00:00:00:01":
{"1": [[1, 2], [5, 10]], "4": [[3, 4]]}}
self.controller.switches[dpid] = self.switch
self.options.vlan_pool = vlan_pool_json
self.options.vlan_pool = vlan_pool
self.controller.get_switch_or_create(dpid, self.switch.connection)

port_id = 1
Expand Down

0 comments on commit d8229f5

Please sign in to comment.