diff --git a/src/compute/service/__main__.py b/src/compute/service/__main__.py index ccd888d4ea99a4a582d9fb71b7ffaa3c4bed154b..a9f224e152429624b6b5ce1808f1960a089c08f4 100644 --- a/src/compute/service/__main__.py +++ b/src/compute/service/__main__.py @@ -21,10 +21,9 @@ from common.Settings import ( from .ComputeService import ComputeService from .rest_server.RestServer import RestServer from .rest_server.nbi_plugins.debug_api import register_debug_api +from .rest_server.nbi_plugins.etsi_bwm import register_etsi_bwm_api from .rest_server.nbi_plugins.ietf_l2vpn import register_ietf_l2vpn from .rest_server.nbi_plugins.ietf_network_slice import register_ietf_nss -from .rest_server.nbi_plugins.etsi_bwm import register_etsi_bwm_api - terminate = threading.Event() LOGGER = None @@ -61,10 +60,10 @@ def main(): grpc_service.start() rest_server = RestServer() - register_ietf_l2vpn(rest_server) # Registering L2VPN entrypoint - register_ietf_nss(rest_server) # Registering NSS entrypoint register_debug_api(rest_server) register_etsi_bwm_api(rest_server) + register_ietf_l2vpn(rest_server) # Registering L2VPN entrypoint + register_ietf_nss(rest_server) # Registering NSS entrypoint rest_server.start() # Wait for Ctrl+C or termination signal diff --git a/src/compute/service/rest_server/nbi_plugins/etsi_bwm/Tools.py b/src/compute/service/rest_server/nbi_plugins/etsi_bwm/Tools.py index 444bac606827ed0a6ed8aec4e00dd6225deec0b1..023d1006cd807ffeeed40d2e1e7273a580431073 100644 --- a/src/compute/service/rest_server/nbi_plugins/etsi_bwm/Tools.py +++ b/src/compute/service/rest_server/nbi_plugins/etsi_bwm/Tools.py @@ -12,14 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +import json +import logging +import time from flask.json import jsonify from common.proto.context_pb2 import ContextId, Empty, EndPointId, ServiceId, ServiceTypeEnum, Service, Constraint, Constraint_SLA_Capacity, ConfigRule, ConfigRule_Custom, ConfigActionEnum from common.tools.grpc.Tools import grpc_message_to_json from common.tools.object_factory.Context import json_context_id from common.tools.object_factory.Service import json_service_id -import time -import json -import logging LOGGER = logging.getLogger(__name__) diff --git a/src/compute/service/rest_server/nbi_plugins/etsi_bwm/tests_etsi_bwm.txt b/src/compute/service/rest_server/nbi_plugins/etsi_bwm/tests_etsi_bwm.txt new file mode 100644 index 0000000000000000000000000000000000000000..9cfbe5625de45a044e68a8af8ec8f440423da966 --- /dev/null +++ b/src/compute/service/rest_server/nbi_plugins/etsi_bwm/tests_etsi_bwm.txt @@ -0,0 +1,81 @@ +-----------------------GET----------------------- + +curl --request GET \ + --url http://10.1.7.203:80/restconf/bwm/v1/bw_allocations + + +-----------------------POST----------------------- +curl --request POST \ + --url http://10.1.7.203:80/restconf/bwm/v1/bw_allocations \ + --header 'Content-Type: application/json' \ + --data '{ + "allocationDirection": "string", + "appInsId": "service_uuid", + "fixedAllocation": "123", + "fixedBWPriority": "SEE_DESCRIPTION", + "requestType": 0, + "sessionFilter": [ + { + "dstAddress": "192.168.3.2", + "dstPort": [ + "b" + ], + "protocol": "string", + "sourceIp": "192.168.1.2", + "sourcePort": [ + "a" + ] + } + ], + "timeStamp": { + "nanoSeconds": 1, + "seconds": 1 + } +}' + + +-----------------------GET2----------------------- +curl --request GET \ + --url http://10.1.7.203:80/restconf/bwm/v1/bw_allocations/service_uuid + +-----------------------PUT----------------------- + curl --request PUT \ + --url http://10.1.7.203:80/restconf/bwm/v1/bw_allocations/service_uuid \ + --header 'Content-Type: application/json' \ + --data '{ + "allocationDirection": "string", + "appInsId": "service_uuid", + "fixedAllocation": "123", + "fixedBWPriority": "efefe", + "requestType": 0, + "sessionFilter": [ + { + "dstAddress": "192.168.3.2", + "dstPort": [ + "b" + ], + "protocol": "string", + "sourceIp": "192.168.1.2", + "sourcePort": [ + "a" + ] + } + ], + "timeStamp": { + "nanoSeconds": 1, + "seconds": 1 + } +}' + +-----------------------PATCH----------------------- +curl --request PATCH \ + --url http://10.1.7.203:80/restconf/bwm/v1/bw_allocations/service_uuid \ + --header 'Content-Type: application/json' \ + --data '{ + "fixedBWPriority": "uuuuuuuuuuuuuu" +}' + + +-----------------------DELETE----------------------- +curl --request DELETE \ + --url http://10.1.7.203:80/restconf/bwm/v1/bw_allocations/service_uuid \ No newline at end of file