summaryrefslogtreecommitdiffstats
path: root/snaps/domain/test/network_tests.py
diff options
context:
space:
mode:
authorspisarski <s.pisarski@cablelabs.com>2017-07-12 11:14:57 -0600
committerspisarski <s.pisarski@cablelabs.com>2017-07-13 08:05:14 -0600
commite6326cd5e826d19e4dd2b096c17aff35da1757b3 (patch)
treef86cbf32d0660cddc802b7cd381afe264ee78033 /snaps/domain/test/network_tests.py
parentf5f0f1cbcb757a9229a92c3a7f4ea400db11dd07 (diff)
Created domain class for ports.
Create Port domain class so neutron_utils.py functions returning port objects will not be leaking out implementation details as each API version can change these data structures and this should all be handled by the SNAPS neutron utility. JIRA: SNAPS-118 Change-Id: If031a094a9da284e2838691c3b3490359f710c61 Signed-off-by: spisarski <s.pisarski@cablelabs.com>
Diffstat (limited to 'snaps/domain/test/network_tests.py')
-rw-r--r--snaps/domain/test/network_tests.py27
1 files changed, 24 insertions, 3 deletions
diff --git a/snaps/domain/test/network_tests.py b/snaps/domain/test/network_tests.py
index a2f1374..13015b2 100644
--- a/snaps/domain/test/network_tests.py
+++ b/snaps/domain/test/network_tests.py
@@ -14,7 +14,28 @@
# limitations under the License.
import unittest
-from snaps.domain.network import SecurityGroup, SecurityGroupRule
+from snaps.domain.network import Port, SecurityGroup, SecurityGroupRule
+
+
+class PortDomainObjectTests(unittest.TestCase):
+ """
+ Tests the construction of the snaps.domain.network.Port class
+ """
+
+ def test_construction_kwargs(self):
+ ips = ['10', '11']
+ port = Port(
+ **{'name': 'name', 'id': 'id', 'ips': ips})
+ self.assertEqual('name', port.name)
+ self.assertEqual('id', port.id)
+ self.assertEqual(ips, port.ips)
+
+ def test_construction_named(self):
+ ips = ['10', '11']
+ port = Port(ips=ips, id='id', name='name')
+ self.assertEqual('name', port.name)
+ self.assertEqual('id', port.id)
+ self.assertEqual(ips, port.ips)
class SecurityGroupDomainObjectTests(unittest.TestCase):
@@ -52,8 +73,8 @@ class SecurityGroupRuleDomainObjectTests(unittest.TestCase):
def test_construction_kwargs(self):
sec_grp_rule = SecurityGroupRule(
- **{'id': 'id', 'security_group_id': 'grp_id', 'description': 'desc',
- 'direction': 'dir', 'ethertype': 'eType',
+ **{'id': 'id', 'security_group_id': 'grp_id',
+ 'description': 'desc', 'direction': 'dir', 'ethertype': 'eType',
'port_range_min': '10.0.0.100', 'port_range_max': '10.0.0.200',
'protocol': 'proto', 'remote_group_id': 'group_id',
'remote_ip_prefix': 'ip_prefix'})