Commit e56acc1f authored by Carlos Manso's avatar Carlos Manso
Browse files

tests added and cleanup

parent f3c69734
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -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
+3 −3
Original line number Diff line number Diff line
@@ -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__)

+81 −0
Original line number Diff line number Diff line
-----------------------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