Ejemplo n.º 1
0
    def update_network(self,
                       network_id,
                       name=None,
                       admin_state_up=None,
                       shared=None,
                       tenant_id=None,
                       requestslib_kwargs=None):
        """
        @summary: Updates a specified Network
        @param string network_id: The UUID for the network
        @param string name: human readable name for the network,
            may not be unique. (CRUD: CRU)
        @param bool admin_state_up: true or false, the admin state
            of the network. If down, the network does not forward packets.
            Default value is True (CRUD: CRU)
        @param bool shared: specifies if the network can be accessed by any
            tenant. Default value is False. (CRUD: CRU)
        @param string tenant_id: owner of the network. (CRUD: CR)
        """

        url = '{base_url}/networks/{network_id}'.format(base_url=self.url,
                                                        network_id=network_id)

        request = NetworkRequest(name=name,
                                 admin_state_up=admin_state_up,
                                 shared=shared,
                                 tenant_id=tenant_id)
        resp = self.request('PUT',
                            url,
                            response_entity_type=Network,
                            request_entity=request,
                            requestslib_kwargs=requestslib_kwargs)
        return resp
Ejemplo n.º 2
0
    def create_network(self,
                       name=None,
                       admin_state_up=None,
                       shared=None,
                       tenant_id=None,
                       requestslib_kwargs=None):
        """
        @summary: Creates a Network
        @param name: human readable name for the network,
            may not be unique. (CRUD: CRU)
        @type name: string
        @param admin_state_up: true or false, the admin state
            of the network. If down, the network does not forward packets.
            Default value is True (CRUD: CRU)
        @type admin_state_up: bool
        @param shared: specifies if the network can be accessed by any
            tenant. Default value is False. (CRUD: CRU)
        @type shared: bool
        @param tenant_id: owner of the network. (CRUD: CR)
        @type tenant_id: string
        @return: network create response
        @rtype: Requests.response
        """
        url = '{base_url}/networks'.format(base_url=self.url)

        request = NetworkRequest(name=name,
                                 admin_state_up=admin_state_up,
                                 shared=shared,
                                 tenant_id=tenant_id)

        resp = self.request('POST',
                            url,
                            response_entity_type=Network,
                            request_entity=request,
                            requestslib_kwargs=requestslib_kwargs)
        return resp
Ejemplo n.º 3
0
 def setUpClass(cls):
     update_attrs = dict(name='test_name_value',
                         admin_state_up='test_admin_state_up_value',
                         shared='test_shared_value')
     cls.network_model = NetworkRequest(**update_attrs)