예제 #1
0
    def put(self, request, *args, **kwargs):
        """Updates list of equipments."""

        data = request.DATA
        json_validate(SPECS.get('equipment_put_v4')).validate(data)
        response = facade_v4.update_equipment(data['equipments'], request.user)

        return Response(response, status=status.HTTP_200_OK)
예제 #2
0
    def post(self, request, *args, **kwargs):
        """Creates list of equipments."""

        data = request.DATA
        json_validate(SPECS.get('equipment_post')).validate(data)
        response = facade.create_equipment(data['equipments'], request.user)

        return Response(response, status=status.HTTP_201_CREATED)
예제 #3
0
    def put(self, request, *args, **kwargs):
        """Enable/Disable pool member by list of server pool."""

        pools = request.DATA
        json_validate(SPECS.get('pool_member_status')).validate(pools)
        response = facade_pool_deploy.set_poolmember_state(
            pools, request.user)

        return Response(response, status=status.HTTP_200_OK)
예제 #4
0
    def post(self, request, *args, **kwargs):
        """Create new RouteMapEntry."""

        objects = request.DATA
        json_validate(SPECS.get('routemap_post')).validate(objects)
        response = list()
        for obj in objects['route_map_entries']:
            created_obj = facade.create_route_map_entry(obj)
            response.append({'id': created_obj.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #5
0
    def put(self, request, *args, **kwargs):
        """Edit Ipv4."""

        ips = request.DATA
        json_validate(SPECS.get('ipv4_put_v4')).validate(ips)
        response = list()
        for ip in ips['ips']:
            ret = facade_v3.update_ipv4(ip, request.user)
            response.append({'id': ret.id})

        return Response(response, status=status.HTTP_200_OK)
예제 #6
0
    def post(self, request, *args, **kwargs):
        """Save Ipv6."""

        ips = request.DATA
        json_validate(SPECS.get('ipv6_post_v4')).validate(ips)
        response = list()
        for ip in ips['ips']:
            ret = facade_v3.create_ipv6(ip, request.user)
            response.append({'id': ret.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #7
0
    def post(self, request, *args, **kwargs):
        """Create new Neighbor."""

        objects = request.DATA
        json_validate(SPECS.get('neighbor_post')).validate(objects)
        response = list()
        for obj in objects.get('neighbors'):
            created_obj = facade.create_neighbor(obj, request.user)
            response.append({'id': created_obj.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #8
0
    def post(self, request, *args, **kwargs):
        """Create new AS."""

        as_s = request.DATA
        json_validate(SPECS.get('as_post_v4')).validate(as_s)
        response = list()
        for as_ in as_s['asns']:

            as_obj = facade.create_as(as_)
            response.append({'id': as_obj.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #9
0
    def put(self, request, *args, **kwargs):
        """Update ListConfigBGP."""

        objects = request.DATA
        json_validate(SPECS.get('list_config_bgp_put_v4')).validate(objects)
        response = list()
        for obj in objects['lists_config_bgp']:

            created_obj = facade.update_list_config_bgp(obj)
            response.append({'id': created_obj.id})

        return Response(response, status=status.HTTP_200_OK)
예제 #10
0
    def put(self, request, *args, **kwargs):
        """Update AS."""

        as_s = request.DATA
        json_validate(SPECS.get('as_put_v4')).validate(as_s)
        response = list()
        for as_ in as_s['asns']:

            as_obj = facade.update_as(as_)
            response.append({'id': as_obj.id})

        return Response(response, status=status.HTTP_200_OK)
예제 #11
0
    def post(self, request, *args, **kwargs):
        """Create new environment."""

        envs = request.DATA
        json_validate(SPECS.get('environment_post')).validate(envs)
        response = list()
        for env in envs['environments']:

            env_obj = facade.create_environment(env)
            response.append({'id': env_obj.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #12
0
    def post(self, request, *args, **kwargs):
        """Create new AS."""

        as_s = request.DATA
        json_validate(SPECS.get('as_post_v4')).validate(as_s)
        response = list()
        for as_ in as_s['asns']:

            as_obj = facade.create_as(as_)
            response.append({'id': as_obj.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #13
0
    def post(self, request, *args, **kwargs):
        """
        Create new aws_vpc
        """
        aws_vpc = request.DATA
        json_validate(SPECS.get('aws_vpc_post')).validate(aws_vpc)
        response = list()
        for aws_vpc in aws_vpc['aws_vpc']:
            aws_vpc = facade.create_aws_vpc(aws_vpc)
            response.append({'id': aws_vpc.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #14
0
    def put(self, request, *args, **kwargs):
        """Update NeighborV4."""

        objects = request.DATA
        json_validate(SPECS.get('neighbor_v4_put_v4')).validate(objects)
        response = list()
        for obj in objects['neighbors']:

            created_obj = facade.update_neighbor_v4(obj, request.user)
            response.append({'id': created_obj.id})

        return Response(response, status=status.HTTP_200_OK)
예제 #15
0
    def post(self, request, *args, **kwargs):
        """
        Create new vrfs
        """
        vrfs = request.DATA
        json_validate(SPECS.get('vrf_post')).validate(vrfs)
        response = list()
        for vrf in vrfs['vrfs']:
            vrf = facade.create_vrf(vrf)
            response.append({'id': vrf.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #16
0
    def post(self, request, *args, **kwargs):
        """Create new NeighborV6."""

        objects = request.DATA
        json_validate(SPECS.get('neighbor_v6_post_v4')).validate(objects)
        response = list()
        for obj in objects['neighbors']:

            created_obj = facade.create_neighbor_v6(obj, request.user)
            response.append({'id': created_obj.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #17
0
    def post(self, request, *args, **kwargs):
        """Create new ListConfigBGP."""

        objects = request.DATA
        json_validate(SPECS.get('list_config_bgp_post_v4')).validate(objects)
        response = list()
        for obj in objects['lists_config_bgp']:

            created_obj = facade.create_list_config_bgp(obj)
            response.append({'id': created_obj.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #18
0
    def post(self, request, *args, **kwargs):
        """Create new environment."""

        envs = request.DATA
        json_validate(SPECS.get('environment_post')).validate(envs)
        response = list()
        for env in envs['environments']:

            env_obj = facade.create_environment(env)
            response.append({'id': env_obj.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #19
0
    def put(self, request, *args, **kwargs):

        envs = request.DATA
        json_validate(SPECS.get('environment_vip_put')).validate(envs)
        response = list()
        for env in envs['environments_vip']:

            ret = facade.update_environment_vip(env)
            response.append({'id': ret.id, 'msg': 'success'})

        return CustomResponse(response,
                              status=status.HTTP_200_OK,
                              request=request)
예제 #20
0
    def post(self, request, *args, **kwargs):
        """Creates list of Object Group Permissions."""

        data = request.DATA

        json_validate(SPECS.get('ogp_post')).validate(data)

        response = list()
        for ogp in data['ogps']:
            ogp = facade_ogp.create_ogp(ogp)
            response.append({'id': ogp.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #21
0
    def put(self, request, *args, **kwargs):
        """Updates list of vlans."""

        data = request.DATA

        json_validate(SPECS.get('vlan_put')).validate(data)

        response = list()
        for vlan in data['vlans']:
            vl = facade.update_vlan(vlan, request.user)
            response.append({'id': vl.id})

        return Response(response, status=status.HTTP_200_OK)
예제 #22
0
    def put(self, request, *args, **kwargs):
        """Updates list of vlans."""

        data = request.DATA

        json_validate(SPECS.get('vlan_put')).validate(data)

        response = list()
        for vlan in data['vlans']:
            vl = facade.update_vlan(vlan, request.user)
            response.append({'id': vl.id})

        return Response(response, status=status.HTTP_200_OK)
예제 #23
0
    def post(self, request, *args, **kwargs):
        """Creates list of networkv4."""

        data = request.DATA

        json_validate(SPECS.get('networkv4_post')).validate(data)

        response = list()
        for networkv4 in data['networks']:
            vl = facade.create_networkipv4(networkv4, request.user)
            response.append({'id': vl.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #24
0
    def post(self, request, *args, **kwargs):

        envs = request.DATA
        json_validate(SPECS.get('environment_vip_post')).validate(envs)
        response = list()
        for env in envs['environments_vip']:

            ret = facade.create_environment_vip(env)
            response.append({
                'id': ret.id
            })

        return Response(response, status=status.HTTP_201_CREATED)
    def post(self, request, *args, **kwargs):
        """Creates list of networkv4."""

        data = request.DATA

        json_validate(SPECS.get('networkv4_post')).validate(data)

        response = list()
        for networkv4 in data['networks']:
            vl = facade.create_networkipv4(networkv4, request.user)
            response.append({'id': vl.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #26
0
    def put(self, request, *args, **kwargs):
        """Update Virtual Interface."""

        virtual_interfaces = request.DATA
        json_validate(SPECS.get('virtual_interface_put_v4')).\
            validate(virtual_interfaces)
        response = list()
        for vi_ in virtual_interfaces['virtual_interfaces']:

            vi_obj = facade.update_virtual_interface(vi_)
            response.append({'id': vi_obj.id})

        return Response(response, status=status.HTTP_200_OK)
    def put(self, request, *args, **kwargs):
        """Updates list of networkv4."""

        data = request.DATA

        json_validate(SPECS.get('networkv4_put')).validate(data)

        response = list()
        for networkv4 in data['networks']:
            vl = facade.update_networkipv4(networkv4, request.user, force=True)
            response.append({'id': vl.id})

        return Response(response, status=status.HTTP_200_OK)
예제 #28
0
    def post(self, request, *args, **kwargs):
        """
        Save server pool
        """

        pools = request.DATA
        json_validate(SPECS.get('pool_post')).validate(pools)
        verify_ports(pools)
        response = list()
        for pool in pools['server_pools']:
            pl = facade.create_pool(pool, request.user)
            response.append({'id': pl.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #29
0
    def put(self, request, *args, **kwargs):
        """
        Update vrfs
        """
        vrfs = request.DATA
        json_validate(SPECS.get('vrf_put')).validate(vrfs)
        response = list()
        for vrf in vrfs['vrfs']:
            vrf = facade.update_vrf(vrf)
            response.append({'id': vrf.id})

        return CustomResponse(response,
                              status=status.HTTP_200_OK,
                              request=request)
예제 #30
0
    def put(self, request, *args, **kwargs):
        """
        Update aws_vpc
        """
        aws_vpc = request.DATA
        json_validate(SPECS.get('aws_vpc_put')).validate(aws_vpc)
        response = list()
        for aws_vpc in aws_vpc['aws_vpc']:
            aws_vpc = facade.update_aws_vpc(aws_vpc)
            response.append({
                'id': aws_vpc.id
            })

        return Response(response, status=status.HTTP_200_OK)
예제 #31
0
    def post(self, request, *args, **kwargs):
        """
        Save server pool
        """

        pools = request.DATA
        json_validate(SPECS.get('pool_post')).validate(pools)
        verify_ports(pools)
        response = list()
        for pool in pools['server_pools']:
            pl = facade.create_pool(pool, request.user)
            response.append({'id': pl.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #32
0
    def put(self, request, *args, **kwargs):
        """
        Update vrfs
        """
        vrfs = request.DATA
        json_validate(SPECS.get('vrf_put')).validate(vrfs)
        response = list()
        for vrf in vrfs['vrfs']:
            vrf = facade.update_vrf(vrf)
            response.append({
                'id': vrf.id
            })

        return Response(response, status=status.HTTP_200_OK)
예제 #33
0
    def put(self, request, *args, **kwargs):
        """Update CIDR."""

        cidrs = request.DATA

        json_validate(SPECS.get('cidr_put')).validate(cidrs)

        response = list()

        for cidr in cidrs['cidr']:
            cidr_obj = facade.update_cidr(cidr)
            response.append(dict(id=cidr_obj))

        return Response(response, status=status.HTTP_200_OK)
예제 #34
0
    def patch(self, request, *args, **kwargs):
        """
        Updates list of vip request in equipments

        """
        vips = request.DATA
        json_validate(SPECS.get('vip_request_patch')).validate(vips)
        locks_list = create_lock(vips.get('vips'), LOCK_VIP)
        try:
            response = facade.patch_real_vip_request(
                vips['vips'], request.user)
        except Exception, exception:
            log.error(exception)
            raise api_exceptions.NetworkAPIException(exception)
예제 #35
0
    def put(self, request, *args, **kwargs):
        """Update RouteMap."""

        objects = request.DATA
        json_validate(SPECS.get('route_map_put_v4')).validate(objects)
        response = list()
        for obj in objects['route_maps']:

            created_obj = facade.update_route_map(obj)
            response.append({
                'id': created_obj.id
            })

        return Response(response, status=status.HTTP_200_OK)
예제 #36
0
    def post(self, request, *args, **kwargs):
        """
        Create new vrfs
        """
        vrfs = request.DATA
        json_validate(SPECS.get('vrf_post')).validate(vrfs)
        response = list()
        for vrf in vrfs['vrfs']:
            vrf = facade.create_vrf(vrf)
            response.append({'id': vrf.id})

        return CustomResponse(response,
                              status=status.HTTP_201_CREATED,
                              request=request)
예제 #37
0
    def post(self, request, *args, **kwargs):
        """Create new RouteMapEntry."""

        objects = request.DATA

        json_validate(SPECS.get('routemap_post')).validate(objects)

        response = list()

        for obj in objects['route_map']:
            created_obj = facade.create_route_map_entry(obj)
            response.append({'id': created_obj.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #38
0
    def put(self, request, *args, **kwargs):

        envs = request.DATA
        json_validate(SPECS.get('environment_vip_put')).validate(envs)
        response = list()
        for env in envs['environments_vip']:

            ret = facade.update_environment_vip(env)
            response.append({
                'id': ret.id,
                'msg': 'success'
            })

        return Response(response, status=status.HTTP_200_OK)
예제 #39
0
    def put(self, request, *args, **kwargs):
        """Update AS."""

        as_s = request.DATA
        json_validate(SPECS.get('as_put_v4')).validate(as_s)
        response = list()
        for as_ in as_s['asns']:

            as_obj = facade.update_as(as_)
            response.append({
                'id': as_obj.id
            })

        return Response(response, status=status.HTTP_200_OK)
예제 #40
0
    def put(self, request, *args, **kwargs):
        """Updates list of networkv4."""

        data = request.DATA

        json_validate(SPECS.get('networkv4_put')).validate(data)

        response = list()
        for networkv4 in data['networks']:
            vl = facade.update_networkipv4(networkv4, request.user,
                                           force=True)
            response.append({'id': vl.id})

        return Response(response, status=status.HTTP_200_OK)
예제 #41
0
    def put(self, request, *args, **kwargs):
        """Update NeighborV4."""

        objects = request.DATA
        json_validate(SPECS.get('neighbor_v4_put_v4')).validate(objects)
        response = list()
        for obj in objects['neighbors']:

            created_obj = facade.update_neighbor_v4(obj, request.user)
            response.append({
                'id': created_obj.id
            })

        return Response(response, status=status.HTTP_200_OK)
예제 #42
0
    def put(self, request, *args, **kwargs):
        """
        Update environment
        """
        envs = request.DATA
        json_validate(SPECS.get('environment_put')).validate(envs)
        response = list()
        for env in envs['environments']:

            env = facade.update_environment(env)
            response.append({
                'id': env.id
            })

        return CustomResponse(response, status=status.HTTP_200_OK, request=request)
예제 #43
0
    def put(self, request, *args, **kwargs):
        """
        Updates pools by list in equipments
        """

        server_pools = request.DATA
        json_validate(SPECS.get('pool_put')).validate(server_pools)
        verify_ports(server_pools)
        locks_list = create_lock(server_pools.get('server_pools'), LOCK_POOL)
        try:
            response = facade_pool_deploy.update_real_pool(
                server_pools, request.user)
        except Exception, exception:
            log.error(exception)
            raise rest_exceptions.NetworkAPIException(exception)
예제 #44
0
    def put(self, request, *args, **kwargs):
        """Enable/Disable pool member by list of server pool
        """
        try:
            pools = request.DATA
            json_validate(SPECS.get('pool_member_status')).validate(pools)
            response = facade_pool_deploy.set_poolmember_state(
                pools, request.user)

            return CustomResponse(response,
                                  status=status.HTTP_200_OK,
                                  request=request)
        except Exception, exception:
            log.error(exception)
            raise rest_exceptions.NetworkAPIException(exception)
예제 #45
0
    def put(self, request, *args, **kwargs):
        """
        Updates pools by list in equipments
        """

        server_pools = request.DATA
        json_validate(SPECS.get('pool_put')).validate(server_pools)
        verify_ports(server_pools)
        locks_list = create_lock(server_pools.get('server_pools'), LOCK_POOL)
        try:
            response = facade_pool_deploy.update_real_pool(
                server_pools.get('server_pools'), request.user)
        except Exception, exception:
            log.error(exception)
            raise rest_exceptions.NetworkAPIException(exception)
예제 #46
0
    def put(self, request, *args, **kwargs):
        """
        Updates server pool
        """

        pools = request.DATA
        json_validate(SPECS.get('pool_put')).validate(pools)
        verify_ports(pools)
        response = dict()
        # response = list()
        for pool in pools['server_pools']:
            facade.update_pool(pool, request.user)
            # pl = facade.update_pool(pool)
            # response.append({'id': pl.id})

        return Response(response, status=status.HTTP_200_OK)
예제 #47
0
    def put(self, request, *args, **kwargs):
        """
        Updates server pool
        """

        pools = request.DATA
        json_validate(SPECS.get('pool_put')).validate(pools)
        verify_ports(pools)
        response = dict()
        # response = list()
        for pool in pools['server_pools']:
            facade.update_pool(pool, request.user)
            # pl = facade.update_pool(pool)
            # response.append({'id': pl.id})

        return Response(response, status=status.HTTP_200_OK)
예제 #48
0
    def put(self, request, *args, **kwargs):
        """
        Updates list of vip request
        """
        data = request.DATA

        json_validate(SPECS.get('vip_request_put')).validate(data)

        locks_list = create_lock(data['vips'], LOCK_VIP)
        try:
            verify_ports_vip(data)
            for vip in data['vips']:
                facade.update_vip_request(vip, request.user)
        except Exception, exception:
            log.error(exception)
            raise api_exceptions.NetworkAPIException(exception)
예제 #49
0
    def post(self, request, *args, **kwargs):
        """Create new NeighborV4."""

        objects = request.DATA
        simple = request.GET.get('simple', None)

        response = list()
        for obj in objects['neighbors']:
            if not simple:
                json_validate(
                    SPECS.get('neighbor_v4_post_v4')).validate(objects)
                created_obj = facade.create_neighbor_v4(obj, request.user)
                response.append({'id': created_obj.id})
            else:
                response += facade.create_neighbor_simple(obj, request.user)

        return Response(response, status=status.HTTP_201_CREATED)
예제 #50
0
    def put(self, request, *args, **kwargs):
        """
        Updates list of equipments
        """
        data = request.DATA

        json_validate(SPECS.get('equipment_put')).validate(data)

        locks_list = create_lock(data['equipments'], LOCK_EQUIPMENT)
        try:
            response = list()
            for equipment in data['equipments']:
                eqpt = facade.update_equipment(equipment, request.user)
                response.append({'id': eqpt.id})
        except Exception, exception:
            log.error(exception)
            raise api_exceptions.NetworkAPIException(exception)
예제 #51
0
    def put(self, request, *args, **kwargs):
        """Updates list of interfaces."""

        response = list()
        data = request.DATA

        json_validate(SPECS.get('interface_put')).validate(data)
        locks_list = create_lock(data['interfaces'], LOCK_INTERFACE)

        for interface in data['interfaces']:
            try:
                interface = facade.update_interface(interface)
                response.append({'id': interface.id})
            finally:
                destroy_lock(locks_list)

        return Response(response, status=status.HTTP_200_OK)
예제 #52
0
    def put(self, request, *args, **kwargs):
        """
        Updates list of networkv6
        """

        data = request.DATA

        json_validate(SPECS.get('networkv6_put')).validate(data)

        response = list()
        for networkv6 in data['networks']:
            vl = facade.update_networkipv6(networkv6, request.user)
            response.append({'id': vl.id})

        return CustomResponse(response,
                              status=status.HTTP_200_OK,
                              request=request)
예제 #53
0
    def post(self, request, *args, **kwargs):
        """
        Creates list of equipments
        """

        data = request.DATA

        json_validate(SPECS.get('equipment_post')).validate(data)

        response = list()
        for equipment in data['equipments']:
            eqpt = facade.create_equipment(equipment, request.user)
            response.append({'id': eqpt.id})

        return CustomResponse(response,
                              status=status.HTTP_201_CREATED,
                              request=request)
예제 #54
0
    def post(self, request, *args, **kwargs):
        """
        Creates list of vlans
        """

        data = request.DATA

        json_validate(SPECS.get('vlan_post')).validate(data)

        response = list()
        for vlan in data['vlans']:
            vl = facade.create_vlan(vlan, request.user)
            response.append({'id': vl.id})

        return CustomResponse(response,
                              status=status.HTTP_201_CREATED,
                              request=request)
예제 #55
0
    def put(self, request, *args, **kwargs):
        """Updates list of interfaces."""

        response = list()
        data = request.DATA

        json_validate(SPECS.get('interface_put')).validate(data)
        locks_list = create_lock(data['interfaces'], LOCK_INTERFACE)

        for interface in data['interfaces']:
            try:
                interface = facade.update_interface(interface)
                response.append({'id': interface.id})
            finally:
                destroy_lock(locks_list)

        return Response(response, status=status.HTTP_200_OK)
예제 #56
0
    def post(self, request, *args, **kwargs):
        """
        Creates list of vip request
        """

        data = request.DATA

        json_validate(SPECS.get('vip_request_post')).validate(data)

        response = list()
        verify_ports_vip(data)
        for vip in data['vips']:

            vp = facade.create_vip_request(vip, request.user)
            response.append({'id': vp.id})

        return Response(response, status=status.HTTP_201_CREATED)
예제 #57
0
    def put(self, request, *args, **kwargs):
        """Edit Ipv6."""

        response = list()
        ips = request.DATA
        json_validate(SPECS.get('ipv6_put_v4')).validate(ips)

        user = request.user

        for ip in ips['ips']:
            task_obj = tasks.update_ipv6.apply_async(args=[ip, user.id],
                                                     queue='napi.network')

            task = {
                'task_id': task_obj.id
            }

            response.append(task)

        return Response(response, status=status.HTTP_202_ACCEPTED)