Exemplo n.º 1
0
 def handle(self, request, context):
     client = api.get_client(request)
     try:
         client.subnet.create(**context)
         return True
     except Exception:
         return False
Exemplo n.º 2
0
def get_node(request, node_type, node_id):
        client = get_client(request)
        nodes = client.nodes.list()

        for node in nodes:
            if node.type == node_type and node.id == node_id:
                return node
Exemplo n.º 3
0
    def get_context_data(self, request):
        port_id = self.tab_group.kwargs['port_id']
        client = get_client(self.request)
        port = client.neutron.ports.get(port_id)

        data = get_ovs_ids(client, port_id)
        data["port"] = port
        return data
Exemplo n.º 4
0
    def get_neutron_ports_data(self):
        network_id = self.kwargs['network_id']
        client = get_client(self.request)
        port_list = client.neutron.ports.list()

        ports = []
        for p in port_list:
            if p.network_id == network_id:
                ports.append(p)

        return ports
Exemplo n.º 5
0
    def get_neutron_subnets_data(self):
        network_id = self.kwargs['network_id']
        client = get_client(self.request)
        subnet_list = client.neutron.subnets.list()

        subnets = []
        for s in subnet_list:
            if s.network_id == network_id:
                subnets.append(s)

        return subnets
Exemplo n.º 6
0
    def get_context_data(self, request):
        client = get_client(request)

        data = {}

        for c in client.connection_manager.list():
            if (c.type == self.tab_group.kwargs['node_type'] and
                    c.id == self.tab_group.kwargs['node_id']):
                data['connection'] = c
                break

        return data
Exemplo n.º 7
0
    def get(self, request, node_type, node_id, table, row=None):
        client = get_client(request)

        if row is not None:
            result = client.ovsdb.get(node_type, node_id, table, row)
        else:
            result = client.ovsdb.list(node_type, node_id, table)

        tmp = table_defs.TABLES.get(table).copy()
        if result["rows"] is not None:
            rows = clean(result["rows"])
            tmp["rows"] = rows

        return http.HttpResponse(
            json.dumps(result), content_type='application/json')
Exemplo n.º 8
0
    def get(self, request):
        client = get_client(request)
        jolokia = Client(
            client.http_client,
            jolokia_base='/controller/nb/v2/jolokia')

        elements = ['Memory', 'Threading']

        reqs = []
        for i in elements:
            reqs.append({'type': 'read', 'mbean': 'java.lang:type=%s' % i})

        response = jolokia.do_requests(make_requests(reqs))

        data = {}
        for i in xrange(0, len(elements)):
            data[elements[i].lower()] = response[i]['value']

        return http.HttpResponse(
            json.dumps(data), content_type='application/json')
Exemplo n.º 9
0
 def _get_data(self):
     network_id = self.kwargs['network_id']
     client = get_client(self.request)
     network = client.neutron.networks.get(network_id)
     return network
Exemplo n.º 10
0
 def get_data(self):
     client = get_client(self.request)
     return client.neutron.networks.list()
Exemplo n.º 11
0
 def get_connectortable_data(self):
     client = get_client(self.request)
     return client.nodes.list_connectors(**self.tab_group.kwargs)
Exemplo n.º 12
0
 def get_context_data(self, request):
     subnet_id = self.tab_group.kwargs['subnet_id']
     client = get_client(self.request)
     subnet = client.neutron.subnets.get(subnet_id)
     return { "subnet" : subnet }
Exemplo n.º 13
0
 def action(self, request, obj_id):
     client = get_client(request)
     node_id, node_type = obj_id.split("#")
     client.connection_manager.delete(node_type, node_id)
Exemplo n.º 14
0
 def update_cell(self, request, datum, obj_id, cell_name, new_cell_value):
     client = get_client(request)
     node_id, node_type = obj_id.split('#')
     client.nodes.create_property(
         node_type, node_id, cell_name, new_cell_value)
Exemplo n.º 15
0
 def delete(self, request, obj_id):
     client = get_client(request)
     client.subnet.delete(obj_id)
Exemplo n.º 16
0
 def get_subnets_data(self):
     client = get_client(self.request)
     return client.subnets.list()
Exemplo n.º 17
0
 def get_staticroutes_data(self):
     client = get_client(self.request)
     return client.staticroutes.list()
Exemplo n.º 18
0
 def get_data(self):
     client = get_client(self.request)
     return client.nodes.list()
Exemplo n.º 19
0
 def delete(self, request, obj_id):
     client = get_client(request)
     client.staticroutes.delete(obj_id)
Exemplo n.º 20
0
 def get_data(self):
     client = get_client(self.request)
     data = client.connection_manager.list()
     return data