예제 #1
0
def reachabilitytest_update(request, reachabilitytest_id, **params):
    """Update a reachability test.

    :param request: request context
    :param tenant_id: (optional) tenant id of the reachability test modified
    :param name: name of the reachability test
    :param src_tenant_id: tenant id of the source ip
    :param src_segment_id: segment id of the source ip
    :param src_ip: source ip of the reachability test
    :param dst_ip: destination ip of the reachability test
    :param expected_result: expected result of the reachability test
    :param run_test: boolean flag to run the test
    """
    LOG.debug("reachabilitytest_update(): params=%s", params)
    if 'tenant_id' in params:
        LOG.debug("Removing tenant_id from params, it cannot be changed")
        params.pop('tenant_id')
    if 'id' in params:
        LOG.debug("Removing id from params, it cannot be changed")
        params.pop('id', None)
    body = {'reachabilitytest': params}
    reachabilitytest = neutronclient(request)\
        .update_reachabilitytest(reachabilitytest_id, body)\
        .get('reachabilitytest')
    return NeutronAPIDictWrapper(reachabilitytest)
예제 #2
0
def reachabilityquicktest_list(request, **params):
    LOG.debug("reachabilityquicktest_list(): params=%s", params)
    reachabilityquicktests = neutronclient(request)\
        .list_reachabilityquicktests(**params)
    return \
        [NeutronAPIDictWrapper(obj)
         for obj in reachabilityquicktests['reachabilityquicktests']]
예제 #3
0
def networktemplateassignment_update(request,
                                     networktemplateassignment_id,
                                     **params):
    """Update a network template assignemnt.

    :param request: request context
    :param networktemplate_id: id of the network template
    :param tenant_id: (optional) tenant id of the network template updated
    :param stack_id: id of the heat stack
    """
    LOG.debug("networktemplateassignment_update(): id=%s params=%s",
              networktemplateassignment_id,
              params)
    # cannot update tenant_id
    if 'tenant_id' in params:
        LOG.debug("Removing tenant_id from params, it cannot be changed")
        params.pop('tenant_id')
    # remove id when modifying object. it cannot be changed
    if 'id' in params:
        LOG.debug("Removing id from params, it cannot be changed")
        params.pop('id', None)
    body = {'networktemplateassignment': params}
    networktemplateassignment = neutronclient(request)\
        .update_networktemplateassignment(networktemplateassignment_id, body)\
        .get('networktemplateassignment')
    return NeutronAPIDictWrapper(networktemplateassignment)
예제 #4
0
def networktemplate_get(request, networktemplate_id):
    LOG.debug("networktemplate_get(): networktemplate_id=%s",
              networktemplate_id)
    networktemplate = neutronclient(request)\
        .show_networktemplate(networktemplate_id)\
        .get('networktemplate')
    return NeutronAPIDictWrapper(networktemplate)
예제 #5
0
def networktemplateassignment_get(request, networktemplateassignment_id):
    LOG.debug("networktemplateassignment_get(): id=%s",
              networktemplateassignment_id)
    networktemplateassignment = neutronclient(request)\
        .show_networktemplateassignment(networktemplateassignment_id)\
        .get('networktemplateassignment')
    return NeutronAPIDictWrapper(networktemplateassignment)
예제 #6
0
def tenantpolicy_update(request, tenantpolicy_id, **params):
    """Update a tenant policy.

    :param request: request context
    :param tenant_id: (optional) tenant id of the reachability test created
    :param priority:
    :param source: source IP or range
    :param source_port: (optional)
    :param destination: destination IP or range
    :param destination_port: (optional)
    :param protocol: (optional) TCP or UDP
    :param action: permit or deny
    :param nexthops: [] list of nexthop IPs
    """
    LOG.debug("tenantpolicy_update(): params=%s", params)
    if 'tenant_id' in params:
        LOG.debug("Removing tenant_id from params, it cannot be changed")
        params.pop('tenant_id')
    if 'id' in params:
        LOG.debug("Removing id from params, it cannot be changed")
        params.pop('id', None)
    body = {'tenantpolicy': params}
    tenantpolicy = (neutronclient(request).update_tenantpolicy(
        tenantpolicy_id, body).get('tenantpolicy'))
    return NeutronAPIDictWrapper(tenantpolicy)
예제 #7
0
def networktemplate_list(request, **params):
    LOG.debug("networktemplate_list(): params=%s", params)
    networktemplates = neutronclient(request)\
        .list_networktemplates(**params)
    object_list = [NeutronAPIDictWrapper(obj)
                   for obj in networktemplates['networktemplates']]
    return object_list
예제 #8
0
def tenantpolicy_list(request, **params):
    LOG.debug("tenantpolicy_list(): params=%s", params)
    tenantpolicies = neutronclient(request).list_tenantpolicies(**params)
    object_list = [
        NeutronAPIDictWrapper(obj) for obj in tenantpolicies['tenantpolicies']
    ]
    return object_list
예제 #9
0
def networktemplateassignment_list(request, **params):
    LOG.debug("networktemplateassignment_list(): params=%s", params)
    networktemplateassignments = neutronclient(request)\
        .list_networktemplateassignments(**params)
    assignlist = \
        [NeutronAPIDictWrapper(obj)
         for obj in networktemplateassignments['networktemplateassignments']]
    return assignlist
예제 #10
0
def reachabilityquicktest_get(request, reachabilityquicktest_id):
    LOG.debug("reachabilityquicktest_get(): id=%s", reachabilityquicktest_id)
    reachabilityquicktest = neutronclient(request)\
        .show_reachabilityquicktest(reachabilityquicktest_id)\
        .get('reachabilityquicktest')
    # add field command_line to put CLI representation
    reachabilityquicktest['command_line'] = \
        convert_to_cli(reachabilityquicktest['detail'])
    return NeutronAPIDictWrapper(reachabilityquicktest)
예제 #11
0
def reachabilitytest_get(request, reachabilitytest_id):
    LOG.debug("reachabilitytest_get(): id=%s", reachabilitytest_id)
    reachabilitytest = neutronclient(request)\
        .show_reachabilitytest(reachabilitytest_id)\
        .get('reachabilitytest')
    # add field command_line to put CLI representation
    reachabilitytest['command_line'] = \
        convert_to_cli(reachabilitytest['detail'])
    # field for CLI repr of logical-path
    reachabilitytest['logical_path_cli'] = convert_logicalpath_to_cli(
        reachabilitytest['logical_path'])
    return NeutronAPIDictWrapper(reachabilitytest)
예제 #12
0
def reachabilitytest_create(request, **params):
    """Create a reachability test.

    :param request: request context
    :param tenant_id: (optional) tenant id of the reachability test created
    :param name: name of the reachability test
    :param src_tenant_name: tenant name of the source ip
    :param src_segment_name: segment name of the source ip
    :param src_ip: source ip of the reachability test
    :param dst_ip: destination ip of the reachability test
    :param expected_result: expected result of the reachability test
    """
    LOG.debug("reachabilitytest_create(): params=%s", params)
    if 'tenant_id' not in params:
        params['tenant_id'] = request.user.project_id
    body = {'reachabilitytest': params}
    reachabilitytest = neutronclient(request)\
        .create_reachabilitytest(body)\
        .get('reachabilitytest')
    return NeutronAPIDictWrapper(reachabilitytest)
예제 #13
0
def networktemplateassignment_create(request, **params):
    """Create a network template.

    :param request: request context
    :param tenant_id: (optional) tenant id of the user
    :param template_id: ID of the network template
    :param stack_id: ID of the heat stack
    """
    LOG.debug("networktemplateassignment_create(): params=%s", params)
    if 'tenant_id' not in params:
        params['tenant_id'] = request.user.project_id
    # remove id when creating object. it is autogenerated
    if 'id' in params:
        LOG.debug("Removing id from params, it cannot be changed")
        params.pop('id', None)
    body = {'networktemplateassignment': params}
    networktemplateassignment = neutronclient(request)\
        .create_networktemplateassignment(body)\
        .get('networktemplateassignment')
    return NeutronAPIDictWrapper(networktemplateassignment)
예제 #14
0
def tenantpolicy_create(request, **params):
    """Create a tenant policy.

    :param request: request context
    :param tenant_id: (optional) tenant id of the reachability test created
    :param priority:
    :param source: source IP or range
    :param source_port: (optional)
    :param destination: destination IP or range
    :param destination_port: (optional)
    :param protocol: (optional) TCP or UDP
    :param action: permit or deny
    :param nexthops: [] list of nexthop IPs
    """
    LOG.debug("tenantpolicy_create(): params=%s", params)
    if 'tenant_id' not in params:
        params['tenant_id'] = request.user.project_id
    body = {'tenantpolicy': params}
    tenantpolicy = (
        neutronclient(request).create_tenantpolicy(body).get('tenantpolicy'))
    return NeutronAPIDictWrapper(tenantpolicy)
예제 #15
0
def networktemplate_create(request, **params):
    """Create a network template.

    :param request: request context
    :param tenant_id: (optional) tenant id of the network template created
    :param name: name of the network template
    :param body: body of the network template
    """
    LOG.debug("networktemplate_create(): params=%s", params)
    if 'tenant_id' in params:
        LOG.debug("Removing tenant_id from params, "
                  "not present in network template")
        params.pop('tenant_id', None)
    # remove id when creating object. it is autogenerated
    if 'id' in params:
        LOG.debug("Removing id from params, it cannot be changed")
        params.pop('id', None)
    body = {'networktemplate': params}
    networktemplate = neutronclient(request)\
        .create_networktemplate(body)\
        .get('networktemplate')
    return NeutronAPIDictWrapper(networktemplate)
예제 #16
0
def tenantpolicy_get(request, tenantpolicy_id):
    LOG.debug("tenantpolicy_get(): id=%s", tenantpolicy_id)
    tenantpolicy = (neutronclient(request).show_tenantpolicy(
        tenantpolicy_id).get('tenantpolicy'))
    return NeutronAPIDictWrapper(tenantpolicy)