示例#1
0
    def get_router_creators(self):
        """
        Returns a list of router creator objects as configured by the heat
        template
        :return: list() of OpenStackRouter objects
        """

        out = list()
        stack_routers = heat_utils.get_stack_routers(self.__heat_cli,
                                                     self.__neutron,
                                                     self.__stack)

        for routers in stack_routers:
            settings = settings_utils.create_router_config(
                self.__neutron, routers)
            creator = OpenStackRouter(self._os_creds, settings)
            out.append(creator)
            creator.initialize()

        return out
示例#2
0
def create_router(os_creds, router_settings, cleanup=False):
    """
    Creates a network on which the CMTSs can attach
    :param os_creds: The OpenStack credentials object
    :param router_settings: The RouterConfig instance
    :param cleanup: Denotes whether or not this is being called for cleanup
    :return: A reference to the network creator objects for each network from
             which network elements such as the subnet, router, interface
             router, and network objects can be accessed.
    """
    # Check for OS for network existence
    # If exists return network instance data
    # Else, create network and return instance data
    logger.info('Attempting to create router with name - %s',
                router_settings.name)
    router_creator = OpenStackRouter(os_creds, router_settings)

    if cleanup:
        router_creator.initialize()
    else:
        router_creator.create()
    logger.info('Created router ')
    return router_creator