{
"properties": {
"undefinedJsonSchema": {
"type": "string",
"description": "Json Schema for the given object is not yet defined"
}
},
"required": [
"undefinedJsonSchema"
]
}
{
"description": "This type represents the general information of a MEC service.",
"type": "object",
"required": [
"serName",
"version",
"state",
"transportInfo",
"serializer"
],
"properties": {
"serInstanceId": {
"description": "Identifier of the service instance assigned by the MEC platform.",
"type": "string",
"readOnly": true,
"example": "ServiceInstance123"
},
"serName": {
"description": "The name of the service. This is how the service producing MEC application identifies the service instance it produces.",
"type": "string",
"example": "ExampleService"
},
"serCategory": {
"description": "This type represents the category reference",
"type": "object",
"required": [
"href",
"id",
"name",
"version"
],
"properties": {
"href": {
"description": "Reference of the catalogue",
"type": "string",
"format": "uri",
"example": "/example/catalogue1"
},
"id": {
"description": "Unique identifier of the category",
"type": "string",
"example": "id12345"
},
"name": {
"description": "Name of the category, example values include RNI, Location & Bandwidth Management",
"type": "string",
"example": "RNI"
},
"version": {
"description": "Category version",
"type": "string",
"example": "version1"
}
}
},
"version": {
"description": "Service version",
"type": "string",
"example": "ServiceVersion1"
},
"state": {
"description": "This enumeration defines the possible states of a service.",
"type": "string",
"enum": [
"ACTIVE",
"INACTIVE"
],
"example": "ACTIVE"
},
"transportInfo": {
"description": "This type represents the general information of a MEC service.",
"type": "object",
"required": [
"id",
"name",
"type",
"protocol",
"version",
"endpoint",
"security"
],
"properties": {
"id": {
"description": "The identifier of this transport",
"type": "string",
"example": "TransId12345"
},
"name": {
"description": "The name of this transport",
"type": "string",
"example": "REST"
},
"description": {
"description": "Human-readable description of this transport",
"type": "string",
"example": "REST API"
},
"type": {
"description": "The enumeration TransportType represents types of transports",
"type": "string",
"enum": [
"REST_HTTP",
"MB_TOPIC_BASED",
"MB_ROUTING",
"MB_PUBSUB",
"RPC",
"RPC_STREAMING",
"WEBSOCKET"
],
"example": "REST_HTTP"
},
"protocol": {
"description": "The name of the protocol used. Shall be set to HTTP for a REST API.",
"type": "string",
"example": "HTTP"
},
"version": {
"description": "The version of the protocol used",
"type": "string",
"example": "2.0"
},
"endpoint": {
"description": "This type represents information about a transport endpoint",
"type": "object",
"oneOf": [{
"description": "Entry point information of the service as string, formatted according to URI syntax",
"type": "object",
"required": [
"uris"
],
"properties": {
"uris": {
"type": "array",
"minItems": 0,
"items": {
"description": "Entry point information of the service",
"type": "string",
"format": "uri",
"example": "/mecSerMgmtApi/service/EntryPoint"
}
}
}
},
{
"description": "Entry point information of the service as one or more pairs of IP address and port",
"type": "object",
"required": [
"addresses"
],
"properties": {
"addresses": {
"type": "array",
"minItems": 0,
"items": {
"description": "A IP address and port pair",
"type": "object",
"required": [
"host",
"port"
],
"properties": {
"host": {
"description": "Host portion of the address",
"type": "string",
"example": "192.0.2.0"
},
"port": {
"description": "Port portion of the address",
"type": "integer",
"format": "uint32",
"example": 8080
}
}
}
}
}
},
{
"description": "Entry point information of the service in a format defined by an implementation, or in an external specification.",
"type": "object",
"required": [
"alternative"
],
"properties": {
"alternative": {
"type": "object"
}
}
}
]
},
"security": {
"description": "This type represents security information related to a transport",
"type": "object",
"properties": {
"oAuth2Info": {
"description": "Parameters related to use of OAuth 2.0",
"required": [
"grantTypes",
"tokenEndpoint"
],
"properties": {
"grantTypes": {
"description": "List of supported OAuth 2.0 grant types.",
"type": "array",
"minItems": 1,
"maxItems": 4,
"items": {
"description": "OAuth 2.0 grant type",
"type": "string",
"enum": [
"OAUTH2_AUTHORIZATION_CODE",
"OAUTH2_IMPLICIT_GRANT",
"OAUTH2_RESOURCE_OWNER",
"OAUTH2_CLIENT_CREDENTIALS"
],
"example": "OAUTH2_CLIENT_CREDENTIALS"
}
},
"tokenEndpoint": {
"description": "The token endpoint",
"type": "string",
"format": "uri",
"example": "/mecSerMgmtApi/security/TokenEndPoint"
}
},
"type": "object"
}
}
},
"implSpecificInfo": {
"description": "Additional implementation specific details of the transport",
"type": "object"
}
}
},
"serializer": {
"description": "The enumeration represents types of serializers",
"type": "string",
"enum": [
"JSON",
"XML",
"PROTOBUF3"
],
"example": "JSON"
},
"scopeOfLocality": {
"description": "The scope of locality as expressed by \"consumedLocalOnly\" and \"isLocal\". If absent, defaults to MEC_HOST",
"type": "string",
"enum": [
"MEC_SYSTEM",
"MEC_HOST",
"NFVI_POP",
"ZONE",
"ZONE_GROUP",
"NFVI_NODE"
],
"example": "MEC_SYSTEM"
},
"consumedLocalOnly": {
"description": "Indicate whether the service can only be consumed by the MEC applications located in the same locality (as defined by scopeOfLocality) as this service instance.",
"type": "boolean",
"example": false
},
"isLocal": {
"description": "Indicate whether the service is located in the same locality (as defined by scopeOfLocality) as the consuming MEC application.",
"type": "boolean",
"example": true
}
}
}
\ No newline at end of file
{
"address": "acr:10.0.0.1",
"callbackReference": {
"callbackData": "1234",
"notifyURL": "http://application.example.com/notifications/distance_notifications/123456"
},
"checkImmediate": "true",
"clientCorrelator": "0123",
"enteringLeavingCriteria": "Entering",
"frequency": "10",
"latitude": "-80.86302",
"longitude": "41.277306",
"radius": "500",
"trackingAccuracy": "10"
}
\ No newline at end of file
{
"address": "acr:10.0.0.1",
"callback": {
"callbackData": "1234",
"notifyURL": "http://application.example.com/notifications/distance_notifications/123456"
},
"checkImmediate": "true",
"clientCorrelator": "0123",
"enteringLeavingCriteria": "Entering",
"frequency": "10",
"latitude": "-80.86302",
"longitude": "41.277306",
"radius": "500",
"trackingAccuracy": "10"
}
\ No newline at end of file
{
"properties": {
"undefinedJsonSchema": {
"type": "string",
"description": "Json Schema for the given object is not yet defined"
}
},
"required": [
"undefinedJsonSchema"
]
}
\ No newline at end of file
{
"properties": {
"undefinedJsonSchema": {
"type": "string",
"description": "Json Schema for the given object is not yet defined"
}
},
"required": [
"undefinedJsonSchema"
]
}
\ No newline at end of file
{
"properties": {
"undefinedJsonSchema": {
"type": "string",
"description": "Json Schema for the given object is not yet defined"
}
},
"required": [
"undefinedJsonSchema"
]
}
\ No newline at end of file
{
"properties": {
"undefinedJsonSchema": {
"type": "string",
"description": "Json Schema for the given object is not yet defined"
}
},
"required": [
"undefinedJsonSchema"
]
}
{
"type": "object",
"properties": {
"accessPointId": {
"description": "The identity of the access point the user is currently on, see note 1.",
"type": "string",
"x-etsi-mec-cardinality": "1",
"x-etsi-mec-origin-type": "String"
},
"address": {
"description": "Address of user (e.g. 'sip' URI, 'tel' URI, 'acr' URI) currently on the access point, see note 1.",
"format": "uri",
"type": "string",
"x-etsi-mec-cardinality": "1",
"x-etsi-mec-origin-type": "AnyURI"
},
"ancillaryInfo": {
"description": "Reserved for future use.",
"type": "string",
"x-etsi-mec-cardinality": "0..1",
"x-etsi-mec-origin-type": "String"
},
"contextLocationInfo": {
"description": "Contextual information of a user location (e.g. aisle, floor, room number, etc.).",
"type": "string",
"x-etsi-mec-cardinality": "0..1",
"x-etsi-mec-origin-type": "String"
},
"locationInfo": {
"properties": {
"accuracy": {
"type": "number"
},
"accuracyAltitude": {
"type": "number"
},
"accuracySemiMinor": {
"type": "number"
},
"altitude": {
"description": "Location altitude relative to the WGS84 ellipsoid surface.",
"type": "number",
"x-etsi-mec-cardinality": "0..1",
"x-etsi-mec-origin-type": "Float"
},
"confidence": {
"type": "number"
},
"includedAngle": {
"type": "number"
},
"innerRadius": {
"type": "number"
},
"latitude": {
"description": "Location latitude, expressed in the range -90° to +90°. Cardinality greater than one only if \"shape\" equals 7.",
"items": {
"type": "number"
},
"minItems": 1,
"type": "array",
"x-etsi-mec-cardinality": "1..N",
"x-etsi-mec-origin-type": "Float"
},
"longitude": {
"description": "Location longitude, expressed in the range -180° to +180°. Cardinality greater than one only if \"shape\" equals 7.",
"items": {
"type": "number"
},
"minItems": 1,
"type": "array",
"x-etsi-mec-cardinality": "1..N",
"x-etsi-mec-origin-type": "Float"
},
"offsetAngle": {
"type": "number"
},
"orientationMajorAxis": {
"type": "number"
},
"shape": {
"description": "Shape information, as detailed in [14], associated with the reported location coordinate:\n1 = Ellipsoid_Arc\n2 = ellipsoid_Point\n3 = ellipsoid_Point_Altitude\n4 = ellipsoid_Point_Altitude_Uncert_Ellipsoid\n5 = ellipsoid_Point_Uncert_Circle\n6 = ellipsoid_Point_Uncert_Ellipse\n7 = polygon",
"type": "string",
"x-etsi-mec-cardinality": "1",
"x-etsi-mec-origin-type": "Enum_inlined"
},
"uncertaintyRadius": {
"type": "number"
},
"velocity": {
"description": "Structure with attributes relating to the target entity’s velocity, as defined in [14].",
"type": "object",
"x-etsi-mec-cardinality": "0..1",
"x-etsi-mec-origin-type": "Structure (inlined)"
}
},
"required": [
"latitude",
"longitude",
"shape"
],
"type": "object",
"x-etsi-ref": "6.5.3"
},
"resourceURL": {
"description": "Self-referring URL, see note 1.",
"type": "string",
"x-etsi-mec-cardinality": "1",
"x-etsi-mec-origin-type": "String"
},
"timeStamp": {
"properties": {
"nanoSeconds": {
"type": "number"
},
"seconds": {
"type": "number"
}
},
"required": [
"seconds",
"nanoSeconds"
],
"type": "object",
"x-etsi-ref": "6.5.2"
},
"zoneId": {
"description": "The identity of the zone the user is currently within, see note 1.",
"type": "string",
"x-etsi-mec-cardinality": "1",
"x-etsi-mec-origin-type": "String"
}
},
"required": [
"address",
"accessPointId",
"zoneId",
"resourceURL",
"timeStamp"
],
"description": "Represents the information related to a user attached to an access point associated to the MEC host, such access point is in scope of the Location Service instance.\n",
"x-etsi-notes": ":\tAs specified in [5], clause 5.2.2.7.\nNOTE 2: \tAs specified in [5], clause 5.2.2.5.",
"x-etsi-ref": "6.2.2"
}
{
"description": "A type containing list of users.",
"type": "object",
"required": [
"resourceURL"
],
"properties": {
"user": {
"description": "Collection of the zone information list.",
"type": "array",
"items": {
"properties": {
"accessPointId": {
"description": "The identity of the access point the user is currently on, see note 1.",
"type": "string",
"x-etsi-mec-cardinality": "1",
"x-etsi-mec-origin-type": "String"
},
"address": {
"description": "Address of user (e.g. 'sip' URI, 'tel' URI, 'acr' URI) currently on the access point, see note 1.",
"format": "uri",
"type": "string",
"x-etsi-mec-cardinality": "1",
"x-etsi-mec-origin-type": "AnyURI"
},
"ancillaryInfo": {
"description": "Reserved for future use.",
"type": "string",
"x-etsi-mec-cardinality": "0..1",
"x-etsi-mec-origin-type": "String"
},
"contextLocationInfo": {
"description": "Contextual information of a user location (e.g. aisle, floor, room number, etc.).",
"type": "string",
"x-etsi-mec-cardinality": "0..1",
"x-etsi-mec-origin-type": "String"
},
"locationInfo": {
"properties": {
"accuracy": {
"type": "number"
},
"accuracyAltitude": {
"type": "number"
},
"accuracySemiMinor": {
"type": "number"
},
"altitude": {
"description": "Location altitude relative to the WGS84 ellipsoid surface.",
"type": "number",
"x-etsi-mec-cardinality": "0..1",
"x-etsi-mec-origin-type": "Float"
},
"confidence": {
"type": "number"
},
"includedAngle": {
"type": "number"
},
"innerRadius": {
"type": "number"
},
"latitude": {
"description": "Location latitude, expressed in the range -90° to +90°. Cardinality greater than one only if \"shape\" equals 7.",
"items": {
"type": "number"
},
"type": "array",
"x-etsi-mec-cardinality": "1..N",
"x-etsi-mec-origin-type": "Float"
},
"longitude": {
"description": "Location longitude, expressed in the range -180° to +180°. Cardinality greater than one only if \"shape\" equals 7.",
"items": {
"type": "number"
},
"type": "array",
"x-etsi-mec-cardinality": "1..N",
"x-etsi-mec-origin-type": "Float"
},
"offsetAngle": {
"type": "number"
},
"orientationMajorAxis": {
"type": "number"
},
"shape": {
"description": "Shape information, as detailed in [14], associated with the reported location coordinate:\n1 = Ellipsoid_Arc\n2 = ellipsoid_Point\n3 = ellipsoid_Point_Altitude\n4 = ellipsoid_Point_Altitude_Uncert_Ellipsoid\n5 = ellipsoid_Point_Uncert_Circle\n6 = ellipsoid_Point_Uncert_Ellipse\n7 = polygon",
"enum": [
"ELLIPSOID_ARC",
"ELLIPSOID_POINT",
"ELLIPSOID_POINT_ALTITUDE",
"ELLIPSOID_POINT_ALTITUDE_UNCERT_ELLIPSOID",
"ELLIPSOID_POINT_UNCERT_CIRCLE",
"ELLIPSOID_POINT_UNCERT_ELLIPSE",
"POLYGON"
],
"type": "string",
"x-etsi-mec-cardinality": "1",
"x-etsi-mec-origin-type": "Enum (inlined)"
},
"uncertaintyRadius": {
"type": "number"
},
"velocity": {
"description": "Structure with attributes relating to the target entity’s velocity, as defined in [14].",
"type": "object",
"x-etsi-mec-cardinality": "0..1",
"x-etsi-mec-origin-type": "Structure (inlined)"
}
},
"required": [
"latitude",
"longitude",
"shape"
],
"type": "object",
"x-etsi-ref": "6.5.3"
},
"resourceURL": {
"description": "Self-referring URL, see note 1.",
"type": "string",
"x-etsi-mec-cardinality": "1",
"x-etsi-mec-origin-type": "String"
},
"timeStamp": {
"properties": {
"nanoSeconds": {
"type": "number"
},
"seconds": {
"type": "number"
}
},
"required": [
"seconds",
"nanoSeconds"
],
"type": "object",
"x-etsi-ref": "6.5.2"
},
"zoneId": {
"description": "The identity of the zone the user is currently within, see note 1.",
"type": "string",
"x-etsi-mec-cardinality": "1",
"x-etsi-mec-origin-type": "String"
}
},
"required": [
"address",
"accessPointId",
"zoneId",
"resourceURL",
"timeStamp"
],
"type": "object",
"x-etsi-notes": ":\tAs specified in [5], clause 5.2.2.7.\nNOTE 2: \tAs specified in [5], clause 5.2.2.5.",
"x-etsi-ref": "6.2.2"
}
},
"resourceURL": {
"description": "Self referring URL.",
"type": "string",
"format": "uri",
"example": "http://example.com/exampleAPI/location/v1/subscriptions/userTracking/subscription123"
}
}
}
{
"properties": {
"undefinedJsonSchema": {
"type": "string",
"description": "Json Schema for the given object is not yet defined"
}
},
"required": [
"undefinedJsonSchema"
]
}
\ No newline at end of file
{
"properties": {
"undefinedJsonSchema": {
"type": "string",
"description": "Json Schema for the given object is not yet defined"
}
},
"required": [
"undefinedJsonSchema"
]
}
\ No newline at end of file
diff --git a/src/MockServerLibrary/library.py b/src/MockServerLibrary/library.py
index a9e6227..7ba1eed 100644
--- a/src/MockServerLibrary/library.py
+++ b/src/MockServerLibrary/library.py
@@ -66,6 +66,9 @@ class MockServerLibrary(object):
match_type = 'STRICT' if exact else 'ONLY_MATCHING_FIELDS'
req['body'] = {'type': body_type, 'json': json.dumps(body), 'matchType': match_type}
+ if body_type is 'JSON_SCHEMA' and body:
+ req['body'] = {'type': body_type, 'json': json.dumps(body)}
+
return req
def create_mock_response(self, status_code, headers=None, body_type='JSON', body=None):
@@ -97,6 +100,42 @@ class MockServerLibrary(object):
return rsp
+ def create_mock_http_forward(self, path, delay=1, unit='SECONDS'):
+ """Creates a mock http override forward to be used by mockserver.
+
+ Returns the http forward in a dictionary format.
+
+ `path` is the new url where to forward the request
+
+ `delay` is the delay of the forward action
+
+ `unit` is the unit of the delay time (default "SECONDS")
+ """
+ fwd = {}
+ fwd['httpRequest'] = {'path': path}
+ fwd['delay'] = {'timeUnit': unit, 'value': delay}
+
+ return fwd
+
+ def create_mock_expectation_with_http_forward(self, request, forward, count=1, unlimited=True):
+ """Creates a mock expectation with request and forward action to be used by mockserver.
+
+ `request` is a mock request matcher in a dictionary format.
+
+ `forward` is a mock forward in a dictionary format.
+
+ `count` is the number of expected requests
+
+ `unlimited` is a boolean value which, if enabled, allows unspecified number of
+ requests to reply to
+ """
+ data = {}
+ data['httpRequest'] = request
+ data['httpOverrideForwardedRequest'] = forward
+ data['times'] = {'remainingTimes': int(count), 'unlimited': unlimited}
+
+ self.create_mock_expectation_with_data(data)
+
def create_mock_expectation(self, request, response, count=1, unlimited=True):
"""Creates a mock expectation to be used by mockserver.