Commit f74ca589 authored by YannGarcia's avatar YannGarcia
Browse files
parents 6e22fab4 764363d4
......@@ -3,20 +3,25 @@
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt
#set -e
#set -vx
set -vx
DOCKER_FILE=./docker/Dockerfile
if [ -f ${DOCKER_FILE} ]
then
docker rm --force stf569_Mec
docker build --tag stf569_Mec --force-rm -f ${DOCKER_FILE} .
#check and build stf569_mec image
DOCKER_ID=`docker ps -a | grep -e stf569_mec | awk '{ print $1 }'`
if [ ! -z "${DOCKER_ID}" ]
then
docker rm --force stf569_mec
fi
docker build --tag stf569_mec --force-rm -f ${DOCKER_FILE} .
if [ "$?" != "0" ]
then
echo "Docker build failed: $?"
exit -1
fi
docker image ls -a
docker inspect stf569_Mec:latest
docker inspect stf569_mec:latest
if [ "$?" != "0" ]
then
echo "Docker inspect failed: $?"
......
......@@ -5,9 +5,9 @@
#set -e
#set -vx
docker run stf569_Mec:latest "/bin/bash" \
docker run stf569_mec:latest "/bin/bash" \
-c "source /home/etsi/devenv.bash \
&& cd /home/etsi/dev/etsi_emcom/src/AtsMec/objs \
&& cd /home/etsi/dev/etsi_mec/src/AtsMec/objs \
&& ../bin/run_all.bash \
&& ls -ltr ../logs"
......
appInst,ueTag,address,state
appInst01,UeTagA,acr:192.0.0.1,UNREGISTERED
appInst01,UeTagC,acr:192.0.0.3,UNREGISTERED
appInst01,UeTagC,acr:192.0.0.3,INVALID_STATE
appInst02,UeTagB,acr:192.0.0.2,UNREGISTERED
appInst03,UeTagD,acr:192.0.0.4,UNREGISTERED
appInst03,UeTagE,acr:192.0.0.5,UNREGISTERED
......@@ -212,13 +212,15 @@ class mec_database:
def registerUEidentity(self, p_app_inst, p_json_msg):
print(">>> registerUEidentity", p_json_msg)
if p_json_msg["state"] != "REGISTERED" and p_json_msg["state"] != "UNREGISTERED":
return None
return '400 Bad Request'
resp = None
try:
# Check the record exists
r = tuple(self.__ue_information_list__.loc[p_app_inst, p_json_msg["ueIdentityTag"]])
print("registerUEidentity: Find zoneId for appInst: ", p_app_inst, ", r= ", r)
self.__ue_information_list__.loc[p_app_inst, p_json_msg["ueIdentityTag"]]['state'] = p_json_msg["state"]
if self.__ue_information_list__.loc[p_app_inst, p_json_msg["ueIdentityTag"]]['state'] == 'INVALID_STATE':
return '412 Precondition Failed'
self.__ue_information_list__.loc[p_app_inst, p_json_msg["ueIdentityTag"]]['state'] = p_json_msg["state"]
l = (p_json_msg["ueIdentityTag"], p_json_msg["state"])
resp = self.__to_ueIdentityTagInfo__(p_json_msg["ueIdentityTag"], l)
except KeyError:
......
......@@ -96,12 +96,20 @@ class myHandler(http.server.BaseHTTPRequestHandler):
else:
if resp.find('Not Found') != -1:
self.send_response(404, 'Not Found')
resp = ""
elif resp.find('Forbidden') != -1:
self.send_response(403, 'Forbidden')
resp = ""
elif resp.find('Bad Request') != -1:
self.send_response(400, 'Bad Request')
resp = ""
elif resp.find('Precondition Failed') != -1:
self.send_response(412, 'Precondition Failed')
resp = "{\"problemDetails\": {\t\"type\": \"Precondition Failed\",\t\"title\": \"N/A\",\t\"status\": 412,\t\"detail\": \"Wrong preconditions\",\t\"instance\": \"N/A\"}}"
content_type = 'application/problem+json'
elif resp.find('userTrackingSubscription') != -1:
self.send_response(201, 'Created')
resp = ""
else:
self.send_response(200, 'OK')
self.send_header('Host', self.headers.get('Host')) # send_header() shall be after send_response()
......
......@@ -8,9 +8,9 @@ import sys, os, time
import msvcrt
# MEC simulator IPv4 address
#ADDRESS_BINDING = '172.28.4.87'
ADDRESS_BINDING = '172.28.4.87'
#ADDRESS_BINDING = '192.168.1.21'
ADDRESS_BINDING = '192.168.0.17'
#ADDRESS_BINDING = '192.168.0.17'
#ADDRESS_BINDING = '127.0.0.1'
# MEC simulator IPv4 listening port
PORT_NUMBER = 8081
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment