diff --git a/deploy/tfs.sh b/deploy/tfs.sh index 19c0d75a095bc5dc239d1d95237378bcf2fbb8da..3a01606ce32369d0f0968282569eaf4ed59d778c 100755 --- a/deploy/tfs.sh +++ b/deploy/tfs.sh @@ -364,7 +364,7 @@ for COMPONENT in $TFS_COMPONENTS; do echo "Waiting for '$COMPONENT' component..." COMPONENT_OBJNAME=$(echo "${COMPONENT}" | sed "s/\_/-/") kubectl wait --namespace $TFS_K8S_NAMESPACE \ - --for='condition=available' --timeout=90s deployment/${COMPONENT_OBJNAME}service + --for='condition=available' --timeout=300s deployment/${COMPONENT_OBJNAME}service printf "\n" done diff --git a/manifests/opticalcontrollerservice.yaml b/manifests/opticalcontrollerservice.yaml index db760c23e0d0c7365dd52ff01fd431fbcb6f22eb..fcf1be742366bd2f31e63418716b1f1743efb44f 100644 --- a/manifests/opticalcontrollerservice.yaml +++ b/manifests/opticalcontrollerservice.yaml @@ -1,3 +1,17 @@ +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + apiVersion: apps/v1 kind: Deployment metadata: @@ -9,36 +23,39 @@ spec: replicas: 1 template: metadata: - labels: app: opticalcontrollerservice spec: terminationGracePeriodSeconds: 5 containers: - - name: server - image: localhost:32000/tfs/opticalcontroller:dev - imagePullPolicy: Never - ports: - - containerPort: 5022 - - containerPort: 9192 - - env: - - name: LOG_LEVEL - value: "INFO" - - resources: - requests: - cpu: 500m - memory: 128Mi - limits: - cpu: 1000m - memory: 1024Mi + - name: server + image: localhost:32000/tfs/opticalcontroller:dev + imagePullPolicy: Never + ports: + - containerPort: 10060 + - containerPort: 9192 + env: + - name: LOG_LEVEL + value: "INFO" + readinessProbe: + exec: + command: ["/bin/grpc_health_probe", "-addr=:10060"] + livenessProbe: + exec: + command: ["/bin/grpc_health_probe", "-addr=:10060"] + resources: + requests: + cpu: 500m + memory: 128Mi + limits: + cpu: 1000m + memory: 1024Mi --- apiVersion: v1 kind: Service metadata: name: opticalcontrollerservice - labels: + labels: app: opticalcontrollerservice spec: type: ClusterIP @@ -47,8 +64,8 @@ spec: ports: - name: grpc protocol: TCP - port: 5022 - targetPort: 5022 + port: 10060 + targetPort: 10060 - name: metrics protocol: TCP port: 9192 diff --git a/ofc24/startExtraNetConfigAgent.sh b/ofc24/startExtraNetConfigAgent.sh deleted file mode 100755 index 79efe377339ed5e911faefc96177dafbdf574035..0000000000000000000000000000000000000000 --- a/ofc24/startExtraNetConfigAgent.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -Docker_Container=$1 -Docker_Port=$2 -if [ -n "$Docker_Container" ] && [ -n "$Docker_Port" ];then - sudo docker stop "$Docker_Container" -t 1 - - sudo docker rm "$Docker_Container" - - - echo "Creating TPs" - screen -dmS t1 -T xterm sh -c "docker run -p 10.0.2.15:"$Docker_Port":2022 -v ~/tfs-ctrl/tempOC/files:/files --name $Docker_Container -it asgamb1/oc23bgp.img:latest" - sleep 2 - if [ "$( docker container inspect -f '{{.State.Running}}' "$Docker_Container")" = "true" ]; then - - docker exec "$Docker_Container" cp /files/demoECOC21_4.xml demoECOC21.xml - - docker exec "$Docker_Container" /confd/examples.confd/OC23/startNetconfAgent.sh - else - echo "your container is not running yet" - fi -else - echo "Please define the docker container name and port" -fi - diff --git a/src/common/Constants.py b/src/common/Constants.py index 0a36c6ac5bec7e11fed563876441ebe6d17f2cdb..a1913a951aeaa968a594fc3bafcb49581459a0e0 100644 --- a/src/common/Constants.py +++ b/src/common/Constants.py @@ -59,7 +59,7 @@ class ServiceNameEnum(Enum): TE = 'te' FORECASTER = 'forecaster' E2EORCHESTRATOR = 'e2eorchestrator' - OPTICALCONTROLLER = 'opticalcontroller' + OPTICALCONTROLLER = 'opticalcontroller' BGPLS = 'bgpls-speaker' # Used for test and debugging only @@ -88,6 +88,7 @@ DEFAULT_SERVICE_GRPC_PORTS = { ServiceNameEnum.TE .value : 10030, ServiceNameEnum.FORECASTER .value : 10040, ServiceNameEnum.E2EORCHESTRATOR .value : 10050, + ServiceNameEnum.OPTICALCONTROLLER .value : 10060, ServiceNameEnum.BGPLS .value : 20030, # Used for test and debugging only diff --git a/src/opticalcontroller/OpticalController.py b/src/opticalcontroller/OpticalController.py index e1b8c7aebca57c8b1b5031110ae1862926d96a56..0d571a9bdbe42512c19d711efbfa123616815534 100644 --- a/src/opticalcontroller/OpticalController.py +++ b/src/opticalcontroller/OpticalController.py @@ -241,6 +241,5 @@ if __name__ == '__main__': #topologies,links= getTopology() #print ("topologies{} and devices {}".format(topologies,links)) rsa = RSA(nodes_dict, links_dict) - - app.run(host='0.0.0.0', port=5022,debug=True) + app.run(host='0.0.0.0', port=10060,debug=True) diff --git a/src/tests/ofc24/startExtraNetConfigAgent.sh b/src/tests/ofc24/startExtraNetConfigAgent.sh new file mode 100755 index 0000000000000000000000000000000000000000..d9428585ef1040bb0440bf6db100b7f2bc71c970 --- /dev/null +++ b/src/tests/ofc24/startExtraNetConfigAgent.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DOCKER_CONTAINER=$1 +DOCKER_PORT=$2 + +if [ -n "$DOCKER_CONTAINER" ] && [ -n "$DOCKER_PORT" ];then + sudo docker stop "$DOCKER_CONTAINER" -t 1 + sudo docker rm "$DOCKER_CONTAINER" + + echo "Creating TPs" + screen -dmS t1 -T xterm sh -c "docker run -p 10.0.2.15:"$DOCKER_PORT":2022 -v ~/tfs-ctrl/tempOC/files:/files --name $DOCKER_CONTAINER -it asgamb1/oc23bgp.img:latest" + sleep 2 + if [ "$( docker container inspect -f '{{.State.Running}}' "$DOCKER_CONTAINER")" = "true" ]; then + docker exec "$DOCKER_CONTAINER" cp /files/demoECOC21_4.xml demoECOC21.xml + docker exec "$DOCKER_CONTAINER" /confd/examples.confd/OC23/startNetconfAgent.sh + else + echo "your container is not running yet" + fi +else + echo "Please define the docker container name and port" +fi diff --git a/ofc24/start_topo.sh b/src/tests/ofc24/start_topo.sh similarity index 50% rename from ofc24/start_topo.sh rename to src/tests/ofc24/start_topo.sh index 574d0c1d52ee6d12655dd66b950f2e5ffffc9c26..4259842c96ca60aff3b6966aee0f84f00d4fb8f9 100755 --- a/ofc24/start_topo.sh +++ b/src/tests/ofc24/start_topo.sh @@ -1,5 +1,17 @@ #!/bin/bash -asgamb1/flexscale-node.imgasgamb1/flexscale-node.imgasgamb1/flexscale-node.imgasgamb1/flexscale-node.img#!/bin/bash +# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. sudo docker stop na1 -t 1 sudo docker stop na2 -t 1 @@ -20,4 +32,4 @@ source "./startExtraNetConfigAgent.sh" "na2" "2024" sleep 3 screen -dmS t3 -T xterm sh -c 'docker run -p 10.0.2.15:2025:2022 -v ~/tfs-ctrl/tempOC/files:/files --name na3 -it asgamb1/flexscale-node.img:latest ./startNetconfAgent.sh' -screen -dmS t4 -T xterm sh -c 'docker run -p 10.0.2.15:2026:2022 -v ~/tfs-ctrl/tempOC/files:/files --name na4 -it asgamb1/flexscale-node.img:latest ./startNetconfAgent.sh' \ No newline at end of file +screen -dmS t4 -T xterm sh -c 'docker run -p 10.0.2.15:2026:2022 -v ~/tfs-ctrl/tempOC/files:/files --name na4 -it asgamb1/flexscale-node.img:latest ./startNetconfAgent.sh'