# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-from snaps.openstack.create_network import PortSettings
+from snaps.config.network import PortConfig
from snaps.openstack.utils import neutron_utils, keystone_utils
True = up / False = down (default True)
:param internal_subnets: List of subnet names to which to connect this
router for Floating IP purposes
- :param port_settings: List of PortSettings objects
+ :param port_settings: List of PortConfig objects
:return:
"""
self.name = kwargs.get('name')
if kwargs.get('interfaces', kwargs.get('port_settings')):
interfaces = kwargs.get('interfaces', kwargs.get('port_settings'))
for interface in interfaces:
- if isinstance(interface, PortSettings):
+ if isinstance(interface, PortConfig):
self.port_settings.append(interface)
else:
self.port_settings.append(
- PortSettings(**interface['port']))
+ PortConfig(**interface['port']))
if not self.name:
raise RouterConfigError('Name is required')
- def dict_for_neutron(self, neutron, os_creds):
+ def dict_for_neutron(self, neutron, os_creds, project_id):
"""
Returns a dictionary object representing this object.
This is meant to be converted into JSON designed for use by the Neutron
TODO - expand automated testing to exercise all parameters
:param neutron: The neutron client to retrieve external network
information if necessary
- :param os_creds: The OpenStack credentials
+ :param os_creds: The OpenStack credentials for retrieving the keystone
+ client for looking up the project ID when the
+ self.project_name is not None
+ :param project_id: the associated project ID to use when
+ self.project_name is None
:return: the dictionary object
"""
out = dict()
keystone = keystone_utils.keystone_client(os_creds)
project = keystone_utils.get_project(
keystone=keystone, project_name=self.project_name)
- project_id = None
if project:
project_id = project.id
if project_id: