示例#1
0
async def _post(params, session):
    accepted_fields = [
        "description",
        "inputs",
        "interface",
        "resourceId",
        "resourceStateConstraints",
        "title",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/bpocore/market/api/v1/resources/{resourceId}/operations".format(
        **params
    ) + gen_args(
        params, IN_QUERY_PARAMETER
    )
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
示例#2
0
async def _post(params, session):
    accepted_fields = [
        "additionalIpAddresses",
        "backupSchedule",
        "ipAddress",
        "resourcePartitionInfo",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/configmgmt/api/v1/schedule/assignNE".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
async def _post(params, session):
    accepted_fields = [
        "clientType",
        "customerId",
        "description",
        "maxFrameSize",
        "name",
        "otn",
        "port",
        "rate",
        "reSyncInventory",
        "scriptFileProperties",
        "shelf",
        "slot",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/configmgmt/api/v1/port/provision".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
示例#4
0
async def _put(params, session):
    accepted_fields = [
        "additionalAttributes",
        "configMgmtJobId",
        "id",
        "lastExecutionTime",
        "name",
        "nextExecutionTime",
        "numberOfNEs",
        "scheduleDetails",
        "scheduleId",
        "type",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/configmgmt/api/v1/schedules/{scheduleId}".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.put(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "put")
示例#5
0
async def _put(params, session):
    accepted_fields = [
        "deletableBySubTenants",
        "description",
        "id",
        "isBuiltIn",
        "label",
        "sharingPermissionId",
        "updatableBySubTenants",
        "visibleToSubTenants",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/bpocore/market/api/v1/sharing-permissions/{sharingPermissionId}".format(
        **params
    ) + gen_args(
        params, IN_QUERY_PARAMETER
    )
    async with session.put(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "put")
async def _patch(params, session):
    accepted_fields = [
        "imageLocation",
        "ipAddress",
        "name",
        "port",
        "profileId",
        "profileType",
        "protocolType",
        "storageMethod",
        "userName",
        "userPassword",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/configmgmt/api/v2/profiles/{profileId}".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.patch(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "patch")
示例#7
0
async def _post(params, session):
    accepted_fields = [
        "accessUrl",
        "address",
        "description",
        "full",
        "onlyEnableTypes",
        "operationMode",
        "properties",
        "rpId",
        "tenantId",
        "title",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/bpocore/market/api/v1/domains/validate".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
示例#8
0
async def _post(params, session):
    accepted_fields = [
        "capabilityName",
        "id",
        "orchState",
        "properties",
        "providerData",
        "reason",
        "relationshipTypeId",
        "requirementName",
        "sourceId",
        "targetId",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/bpocore/market/api/v1/relationships".format(
        **params
    ) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
async def _post(params, session):
    accepted_fields = ["body", "equipmentId"]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = (
        "https://{mcp_hostname}/nsi/api/equipment/{equipmentId}/maintenanceMode".format(
            **params
        )
        + gen_args(params, IN_QUERY_PARAMETER)
    )
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
async def _put(params, session):
    accepted_fields = [
        "customerName",
        "description",
        "id",
        "policyId",
        "policyName",
        "policyType",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/commissioning/api/v1/policy/".format(
        **params
    ) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.put(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "put")
async def _put(params, session):
    accepted_fields = ["id", "identifierKey"]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/nsi/api/v3/networkConstructs/{id}/identifiers/{identifierKey}".format(
        **params
    ) + gen_args(
        params, IN_QUERY_PARAMETER
    )
    async with session.put(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "put")
示例#12
0
async def _put(params, session):
    accepted_fields = [
        "applicationSliceId",
        "description",
        "extendable",
        "holderTenantId",
        "id",
        "isDefault",
        "name",
        "ownerTenantId",
        "parentId",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/bpocore/market/api/v1/application-slices/{applicationSliceId}".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.put(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "put")
async def _post(params, session):
    accepted_fields = [
        "autoClean",
        "createdAt",
        "custom",
        "description",
        "desiredOrchState",
        "differences",
        "discovered",
        "id",
        "label",
        "method",
        "nativeState",
        "orchState",
        "orderId",
        "productId",
        "properties",
        "providerData",
        "providerResourceId",
        "reason",
        "resourceId",
        "resourceTypeId",
        "revision",
        "shared",
        "sharingPermissionId",
        "subDomainId",
        "tags",
        "tenantId",
        "updateCount",
        "updateReason",
        "updateState",
        "updatedAt",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/bpocore/market/api/v1/resources/{resourceId}/validate".format(
        **params
    ) + gen_args(
        params, IN_QUERY_PARAMETER
    )
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
async def _delete(params, session):
    _url = "https://{mcp_hostname}/tapi/data/context/connectivity-context/provisioning/connectivity-service={uuid}".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.delete(_url) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "delete")
async def _delete(params, session):
    _url = "https://{mcp_hostname}/bpocore/market/api/v1/tag-keys/{tagKey}/tag-values/{tagValue}".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.delete(_url) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "delete")
示例#16
0
async def _get(params, session):
    _url = "https://{mcp_hostname}/nsi/api/v5/tpes".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.get(_url) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "get")
async def _head(params, session):
    _url = "https://{mcp_hostname}/bpocore/market/api/v1/sub-domains/{subDomainId}/containees".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.head(_url) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "head")
示例#18
0
async def _delete(params, session):
    _url = (
        "https://{mcp_hostname}/discovery/api/v3/managementSessions/{sessionId}"
        .format(**params) + gen_args(params, IN_QUERY_PARAMETER))
    async with session.delete(_url) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "delete")
示例#19
0
async def _get(params, session):
    accepted_fields = ["protocolType", "typeGroup"]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/configmgmt/api/v1/customScripts".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.get(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "get")
async def _post(params, session):
    accepted_fields = ["uuid", "value", "value-name"]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/tapi/data/context/connectivity-context/provisioning/connectivity-service={uuid}/name".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
async def _delete(params, session):
    accepted_fields = ["ospfArea", "subnetId"]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/commissioning/api/v2/ipsubnet/".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.delete(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "delete")
async def _put(params, session):
    accepted_fields = ["description", "key", "tagKey", "tagValue", "value"]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/bpocore/market/api/v1/tag-keys/{tagKey}/tag-values/{tagValue}".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.put(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "put")
async def _post(params, session):
    accepted_fields = ["data"]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/ifd/api/v1/serviceIntents/getFeasibleRoute".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
async def _patch(params, session):
    accepted_fields = ["operations", "sessionId"]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/discovery/api/managementSessions/{sessionId}".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.patch(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "patch")
async def _post(params, session):
    accepted_fields = ["networkConstructName", "slotId"]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/configmgmt/api/v1/upgrade/manualInvoke".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.post(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "post")
示例#26
0
async def _head(params, session):
    accepted_fields = ["productId", "providerResourceId", "subDomainId", "tags"]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/bpocore/market/api/v1/resources".format(
        **params
    ) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.head(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "head")
示例#27
0
async def _put(params, session):
    accepted_fields = [
        "asyncProtocolVersion",
        "description",
        "domainSettings",
        "domainType",
        "id",
        "lastUpsertTime",
        "properties",
        "protocolVersion",
        "providerId",
        "relationships",
        "resourceProviderId",
        "resourceTypes",
        "title",
        "uri",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/bpocore/market/api/v1/resource-providers/{resourceProviderId}".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.put(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "put")
示例#28
0
async def _get(params, session):
    accepted_fields = [
        "active",
        "adminState",
        "bookingData.lockout",
        "childFreId",
        "concrete",
        "coroutedFreId",
        "customerName",
        "decomposedFreIds",
        "deploymentState",
        "directionality",
        "displayAdminState",
        "displayDeploymentState",
        "displayOperationState",
        "displayRecoveryCharacteristicsOnHome",
        "displayTopologySource",
        "domainTypes",
        "endDateMax",
        "endDateMin",
        "endpoint.tpe.concrete",
        "facilityBypass",
        "fields",
        "freExpectations.equipmentIntent.id",
        "freExpectations.intent.id",
        "freExpectations.intent.type",
        "freExpectations.serviceIntent.id",
        "freType",
        "gneSubnetName",
        "group",
        "id",
        "identifierKey",
        "identifierValue",
        "include",
        "internalStructure",
        "layerRate",
        "layerRateQualifier",
        "limit",
        "lqsData.fiber.method",
        "lqsData.fiber.reconciled",
        "lqsData.margin.valid",
        "lqsData.margin.viableAtEol",
        "lqsData.ppg.snrStatus",
        "lqsData.status",
        "managementName",
        "metaDataFields",
        "metaDataQualifiers",
        "modelType",
        "namedQuery",
        "namedQueryParam1",
        "ncTags",
        "networkConstruct.id",
        "networkConstruct.id.operator",
        "networkRole",
        "offset",
        "operationState",
        "ovpnIds",
        "partitionFreIds",
        "partitioningFreIds",
        "remoteOSRPNodeName",
        "resilienceLevel",
        "resourceState",
        "ringCompleteness",
        "ringType",
        "roadmLineId",
        "routingConstraints.inclusionConstraints.id",
        "searchFields",
        "searchText",
        "serviceClass",
        "signalContentType",
        "sncgUserlabel",
        "sortBy",
        "srlg",
        "startDateMax",
        "startDateMin",
        "supportedByFreId",
        "supportedByQualifier",
        "supportingFreId",
        "tags",
        "tpe.id",
        "tpe.id.operator",
        "tunnelType",
        "type",
        "userLabel",
    ]
    spec = {}
    for i in accepted_fields:
        if params[i] is not None:
            spec[i] = params[i]
    _url = "https://{mcp_hostname}/nsi/api/v2/search/fres".format(
        **params) + gen_args(params, IN_QUERY_PARAMETER)
    async with session.get(_url, json=spec) as resp:
        content_types = [
            "application/json-patch+json",
            "application/vnd.api+json",
            "application/json",
        ]
        try:
            if resp.headers["Content-Type"] in content_types:
                _json = await resp.json()
            else:
                print("response Content-Type not supported")
        except KeyError:
            _json = {}
        return await update_changed_flag(_json, resp.status, "get")