示例#1
0
 def create_network(self, **kwargs):
     # Supply defaults that are expected to be set by the api
     # framwork
     kwargs.setdefault('admin_state_up', True)
     kwargs.setdefault('shared', False)
     data = dict(network=kwargs)
     result = self.plugin.create_network(self.ctx, data)
     return base_v2.AttributeDict(result)
示例#2
0
 def get_networks(self, *args, **kwargs):
     result = self.plugin.get_networks(self.ctx, *args, **kwargs)
     return [base_v2.AttributeDict(x) for x in result]
示例#3
0
 def get_network(self, *args, **kwargs):
     result = self.plugin.get_network(self.ctx, *args, **kwargs)
     return base_v2.AttributeDict(result)
示例#4
0
 def update_network(self, id_, **kwargs):
     data = dict(network=kwargs)
     result = self.plugin.update_network(self.ctx, id_, data)
     return base_v2.AttributeDict(result)
示例#5
0
 def get_networks(self, **kwargs):
     body = self.client.list_networks(**kwargs)
     return [base_v2.AttributeDict(x) for x in body['networks']]
示例#6
0
 def get_network(self, id_, **kwargs):
     body = self.client.show_network(id_, **kwargs)
     return base_v2.AttributeDict(body['network'])
示例#7
0
 def update_network(self, id_, **kwargs):
     body = self.client.update_network(id_, **kwargs)
     return base_v2.AttributeDict(body['network'])
示例#8
0
 def _create_network(self, **kwargs):
     # Internal method - use create_network() instead
     body = self.client.create_network(**kwargs)
     return base_v2.AttributeDict(body['network'])