From a82209830309354c5bdc7e8b885c51df42c731d1 Mon Sep 17 00:00:00 2001
From: spisarski <s.pisarski@cablelabs.com>
Date: Fri, 17 Nov 2017 16:07:40 -0700
Subject: Refactoring of NetworkSettings to extend NetworkConfig

This also includes SubnetSettings extending to SubnetConfig and
PortSettings extenting to Portconfig and neutron_utils have a runtime cyclical
dependency. This patch reduces this dependency and deprecates the NetworkSettings,
SubnetSettings, and PortSettings classes.

JIRA: SNAPS-220

Change-Id: I996d73d9b910c075a6511a423f01d966f5b6fb74
Signed-off-by: spisarski <s.pisarski@cablelabs.com>
---
 docs/how-to-use/APITests.rst     |  4 ++--
 docs/how-to-use/LibraryUsage.rst | 25 ++++++++++++++-----------
 docs/how-to-use/UnitTests.rst    | 24 +++++++++++++++++++++---
 3 files changed, 37 insertions(+), 16 deletions(-)

(limited to 'docs')

diff --git a/docs/how-to-use/APITests.rst b/docs/how-to-use/APITests.rst
index fe8e51d..83edd66 100644
--- a/docs/how-to-use/APITests.rst
+++ b/docs/how-to-use/APITests.rst
@@ -550,10 +550,10 @@ settings_utils_tests.py - SettingsUtilsNetworkingTests
 +---------------------------------------+---------------+-----------------------------------------------------------+
 | Test Name                             | API           | Description                                               |
 +=======================================+===============+===========================================================+
-| test_derive_net_settings_no_subnet    | Neutron 2     | Tests to ensure that derived NetworkSettings from an      |
+| test_derive_net_settings_no_subnet    | Neutron 2     | Tests to ensure that derived NetworkConfig from an        |
 |                                       |               | OpenStack network are correct without a subnet            |
 +---------------------------------------+---------------+-----------------------------------------------------------+
-| test_derive_net_settings_two_subnets  | Neutron 2     | Tests to ensure that derived NetworkSettings from an      |
+| test_derive_net_settings_two_subnets  | Neutron 2     | Tests to ensure that derived NetworkConfig from an        |
 |                                       |               | OpenStack network are correct with two subnets            |
 +---------------------------------------+---------------+-----------------------------------------------------------+
 
diff --git a/docs/how-to-use/LibraryUsage.rst b/docs/how-to-use/LibraryUsage.rst
index fc22a3d..aa7bf91 100644
--- a/docs/how-to-use/LibraryUsage.rst
+++ b/docs/how-to-use/LibraryUsage.rst
@@ -246,7 +246,7 @@ Create Network
 
 -  Network - snaps.openstack.create\_network.OpenStackNetwork
 
-   -  snaps.openstack.create\_network.NetworkSettings
+   -  snaps.config_network.NetworkConfig
 
       -  name - the name of the network (required)
       -  admin\_state\_up - flag denoting the administrative status of
@@ -263,7 +263,7 @@ Create Network
       -  segmentation\_id - the id of the segmentation (required
          when network\_type is 'vlan')
       -  subnet\_settings (list of optional
-         snaps.openstack.create\_network.SubnetSettings objects)
+         snaps.config.network.SubnetConfig objects)
 
          -  cidr - the subnet's CIDR (required)
          -  ip\_version - 4 or 6 (default=4)
@@ -287,10 +287,11 @@ Create Network
 
 .. code:: python
 
-    from snaps.openstack.create_network import NetworkSettings, SubnetSettings, OpenStackNetwork
+    from snaps.config.network import NetworkConfig, SubnetConfig
+    from snaps.openstack.create_network import OpenStackNetwork
 
-    subnet_settings = SubnetSettings(name='subnet-name', cidr='10.0.0.0/24')
-    network_settings = NetworkSettings(name='network-name', subnet_settings=[subnet_settings])
+    subnet_settings = SubnetConfig(name='subnet-name', cidr='10.0.0.0/24')
+    network_settings = NetworkConfig(name='network-name', subnet_settings=[subnet_settings])
 
     network_creator = OpenStackNetwork(os_creds, network_settings)
     network_creator.create()
@@ -340,10 +341,12 @@ Create Security Group
 
 .. code:: python
 
+    from snaps.config.network import SubnetConfig
+    from snaps.config.rule import RuleConfig
     from snaps.openstack.create_security_group import SecurityGroupSettings, SecurityGroupRuleSettings, Direction, OpenStackSecurityGroup
 
-    rule_settings = SubnetSettings(name='subnet-name', cidr='10.0.0.0/24')
-    network_settings = NetworkSettings(name='network-name', subnet_settings=[subnet_settings])
+    rule_settings = RuleConfig(name='subnet-name', cidr='10.0.0.0/24')
+    network_settings = SubnetConfig(name='network-name', subnet_settings=[subnet_settings])
 
     sec_grp_name = 'sec-grp-name'
     rule_settings = SecurityGroupRuleSettings(name=sec_grp_name, direction=Direction.ingress)
@@ -376,7 +379,7 @@ Create Router
       -  internal\_subnets - list of subnet names to which this router
          will connect (optional)
       -  port\_settings (list of optional
-         snaps.openstack.create\_router.PortSettings objects) - creates
+         snaps.config.network.PortConfig objects) - creates
          custom ports to internal subnets (similar to internal\_subnets
          with more control)
 
@@ -546,7 +549,7 @@ Create VM Instance
       -  name - the name of the VM (required)
       -  flavor - the name of the flavor (required)
       -  port\_settings - list of
-         snaps.openstack.create\_network.PortSettings objects where each
+         snaps.config.network.PortConfig objects where each
          denote a NIC (see above in create router section for details)
          API does not require, but newer NFVIs now require VMs have at
          least one network
@@ -589,9 +592,9 @@ Create VM Instance
 .. code:: python
 
     from snaps.openstack.create_instance import VmInstanceSettings, FloatingIpSettings, OpenStackVmInstance
-    from snaps.openstack.create_network import PortSettings
+    from snaps.config.network import PortConfig
 
-    port_settings = PortSettings(name='port-name', network_name=network_settings.name)
+    port_settings = PortConfig(name='port-name', network_name=network_settings.name)
     floating_ip_settings = FloatingIpSettings(name='fip1', port_name=port_settings.name, router_name=router_settings.name)
     instance_settings = VmInstanceSettings(name='vm-name', flavor='flavor_settings.name', port_settings=[port_settings],
                                            floating_ip_settings=[floating_ip_settings])
diff --git a/docs/how-to-use/UnitTests.rst b/docs/how-to-use/UnitTests.rst
index 044503e..c053372 100644
--- a/docs/how-to-use/UnitTests.rst
+++ b/docs/how-to-use/UnitTests.rst
@@ -174,11 +174,17 @@ RoleDomainObjectTests
 Ensures that all required members are included when constructing a
 Role domain object
 
+NetworkConfigUnitTests
+----------------------
+
+Ensures that all required members are included when constructing a
+NetworkConfig object
+
 NetworkSettingsUnitTests
 ------------------------
 
 Ensures that all required members are included when constructing a
-NetworkSettings object
+deprecated NetworkSettings object
 
 NetworkObjectTests
 ------------------
@@ -186,11 +192,17 @@ NetworkObjectTests
 Ensures that all required members are included when constructing a
 Network domain object
 
+SubnetConfigUnitTests
+---------------------
+
+Ensures that all required members are included when constructing a
+SubnetConfig object
+
 SubnetSettingsUnitTests
 -----------------------
 
 Ensures that all required members are included when constructing a
-SubnetSettings object
+deprecated SubnetSettings object
 
 SubnetObjectTests
 -----------------
@@ -198,11 +210,17 @@ SubnetObjectTests
 Ensures that all required members are included when constructing a
 Subnet domain object
 
+PortConfigUnitTests
+-------------------
+
+Ensures that all required members are included when constructing a
+PortConfig object
+
 PortSettingsUnitTests
 ---------------------
 
 Ensures that all required members are included when constructing a
-PortSettings object
+deprecated PortSettings object
 
 PortDomainObjectTests
 ---------------------
-- 
cgit