diff --git a/lab/linux.me/Dockerfile b/lab/linux.me/Dockerfile deleted file mode 100644 index 83d365fa..00000000 --- a/lab/linux.me/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM centos:7 - -RUN yum install -y redhat-lsb-core openssh-server sudo iptables-services net-snmp net-snmp-utils tcpdump rsyslog - -RUN passwd --stdin root <<< "ubiqube" -RUN useradd msa -RUN passwd --stdin msa <<< "ubiqube" -RUN echo 'msa ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers -#RUN echo ':msg, contains, "Time has been changed" ~ ' > /etc/rsyslog.d/time_msgs.conf -RUN echo '*.* @msa_front' > /etc/rsyslog.d/mini_lab.conf -COPY snmpd.conf /etc/snmp/ -RUN systemctl enable sshd -RUN systemctl enable snmpd -CMD [ "/sbin/init" ] \ No newline at end of file diff --git a/lab/linux.me/snmpd.conf b/lab/linux.me/snmpd.conf deleted file mode 100644 index 87815395..00000000 --- a/lab/linux.me/snmpd.conf +++ /dev/null @@ -1,31 +0,0 @@ -# First, map the community name (COMMUNITY) into a security name -# (local and mynetwork, depending on where the request is coming -# from): - -# sec.name source community -com2sec local localhost public -com2sec mynetwork 0.0.0.0/0 ubiqube - -# Second, map the security names into group names: - -# sec.model sec.name -group MyRWGroup v1 local -group MyRWGroup v2c local -group MyRWGroup usm local -group MyROGroup v1 mynetwork -group MyROGroup v2c mynetwork -group MyROGroup usm mynetwork - -# Third, create a view for us to let the groups have rights to: - -# incl/excl subtree mask -view all included .1 80 - -# Finally, grant the 2 groups access to the 1 view with different -# write permissions: - -# context sec.model sec.level match read write notif -access MyROGroup "" any noauth exact all none none -access MyRWGroup "" any noauth exact all all none - -# ----------------------------------------------------------------------------- diff --git a/lab/linux.me/start.sh b/lab/linux.me/start.sh deleted file mode 100644 index 54a62c63..00000000 --- a/lab/linux.me/start.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -set -x -sudo iptables -I INPUT -p udp -m udp --dport 161 -j ACCEPT -sudo iptables -I INPUT -p udp -m udp --dport 162 -j ACCEPT -sudo iptables-save > /etc/sysconfig/iptables - - diff --git a/lab/msa_dev/Dockerfile b/lab/msa_dev/Dockerfile deleted file mode 100644 index 4bad4948..00000000 --- a/lab/msa_dev/Dockerfile +++ /dev/null @@ -1,34 +0,0 @@ -FROM centos:7 - -RUN groupadd -r ncuser -g 1000 && useradd -r -u 1000 -g ncuser -m -c "ncuser" ncuser - -RUN yum -y install \ - https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.7-1.x86_64.rpm \ - php openssh-server git sudo iproute nano wget unzip \ - python3 python3-pip python3-setuptools && yum -y upgrade git && \ - yum clean all - -RUN git config --global alias.lg "log --graph --pretty=format:'%C(red)%h%C(reset) -%C(yellow)%d%C(reset) %s %C(bold blue)<%an>%C(reset) %C(green)(%ar)%C(reset)' --abbrev-commit --date=relative"; \ - git config --global push.default simple; \ - : - -COPY resources/scripts/create_test_me.sh /usr/bin/ -COPY resources/scripts/create_mini_lab.sh /usr/bin/ -COPY resources/scripts/install_libraries.sh /usr/bin/ -COPY resources/scripts/install_license.sh /usr/bin/ -COPY resources/scripts/wait_for_api.sh /usr/bin/ -COPY resources/scripts/migrate_bpmn.sh /usr/bin/ -COPY resources/scripts/clean_old_topology_instances.sh /usr/bin/ - -ENV PYTHONPATH /opt/fmc_repository/Process/PythonReference/ - -RUN chmod a+x /usr/bin/create_mini_lab.sh; \ - chmod a+x /usr/bin/install_libraries.sh; \ - chmod a+x /usr/bin/create_test_me.sh; \ - chmod a+x /usr/bin/install_license.sh; \ - chmod a+x /usr/bin/wait_for_api.sh; \ - chmod a+x /usr/bin/migrate_bpmn.sh; \ - chmod a+x /usr/bin/clean_old_topology_instances.sh; \ - : - -CMD [ "/sbin/init" ] diff --git a/lab/msa_dev/resources/ai-ml-data/db.json b/lab/msa_dev/resources/ai-ml-data/db.json deleted file mode 100644 index 7f98a66d..00000000 --- a/lab/msa_dev/resources/ai-ml-data/db.json +++ /dev/null @@ -1 +0,0 @@ -{"states": [{"model": "msa_ml_api.state", "pk": 4, "fields": {"unique_id": "ef14d0ee-a6f6-4397-bb10-f4199bacf393", "name": "MSA is not the latest version", "description": "MSA is not the latest version", "tag": null, "transition": [1]}}, {"model": "msa_ml_api.state", "pk": 5, "fields": {"unique_id": "acdbd006-7252-4c7c-81b8-4d22c39a4ec3", "name": "MSA Config is backed up", "description": "MSA Config is backed up", "tag": null, "transition": [2]}}, {"model": "msa_ml_api.state", "pk": 6, "fields": {"unique_id": "8d6a9947-6c35-42a5-a165-69fc4742f146", "name": "MSA Latest config is pulled", "description": "MSA Latest config is pulled", "tag": null, "transition": [3]}}, {"model": "msa_ml_api.state", "pk": 7, "fields": {"unique_id": "a31b72ed-2897-433a-b27b-9dac7597ce1d", "name": "MSA is upgraded to the latest version", "description": "MSA is upgraded to the latest version", "tag": null, "transition": []}}], "actions": [{"model": "msa_ml_api.action", "pk": 1, "fields": {"unique_id": "5f5fc338-4e30-4e51-8923-45babb5a96d0", "name": "Backup MSA Config", "if_condition": {}, "execute": "Process/workflows/Upgrade_MSActivator/Upgrade_MSActivator", "process": "Backup", "process_path": "Process/workflows/Upgrade_MSActivator/Process_Backup", "process_type": "CREATE", "workflow_name": "Upgrade MSActivator", "condition": {}, "description": "Backup MSA Config", "target_state": 5, "tag": null}}, {"model": "msa_ml_api.action", "pk": 2, "fields": {"unique_id": "08647e12-3805-4306-a722-2dafb04ad5db", "name": "Latest config pulled", "if_condition": {}, "execute": "Process/workflows/Upgrade_MSActivator/Upgrade_MSActivator", "process": "Pull Latest Config", "process_path": "Process/workflows/Upgrade_MSActivator/Process_Pull_Latest_Config", "process_type": "CREATE", "workflow_name": "Upgrade MSActivator", "condition": {}, "description": "Latest config pulled", "target_state": 6, "tag": null}}, {"model": "msa_ml_api.action", "pk": 3, "fields": {"unique_id": "8b48d788-ebfc-4c7d-8040-ae7a423a964a", "name": "Run Latest Docker Compose", "if_condition": {}, "execute": "Process/workflows/Upgrade_MSActivator/Upgrade_MSActivator", "process": "Run Docker Compose", "process_path": "Process/workflows/Upgrade_MSActivator/Process_Run_Docker_Compose", "process_type": "CREATE", "workflow_name": "Upgrade MSActivator", "condition": {}, "description": "Run Latest Docker Compose", "target_state": 7, "tag": null}}], "tags": []} \ No newline at end of file diff --git a/lab/msa_dev/resources/opt/fmc_repository/.meta_CommandDefinition b/lab/msa_dev/resources/opt/fmc_repository/.meta_CommandDefinition deleted file mode 100644 index 1e2e3d08..00000000 --- a/lab/msa_dev/resources/opt/fmc_repository/.meta_CommandDefinition +++ /dev/null @@ -1,21 +0,0 @@ - - - - - DATE_MODIFICATION - 1303211038256 - - - REPOSITORY - CommandDefinition - - - DATE_CREATION - 1303211038135 - - - TYPE - REPOSITORY - - - \ No newline at end of file diff --git a/lab/msa_dev/resources/opt/fmc_repository/.meta_Configuration b/lab/msa_dev/resources/opt/fmc_repository/.meta_Configuration deleted file mode 100644 index a066cbdf..00000000 --- a/lab/msa_dev/resources/opt/fmc_repository/.meta_Configuration +++ /dev/null @@ -1,21 +0,0 @@ - - - - - DATE_MODIFICATION - 1312184567689 - - - REPOSITORY - Configuration - - - DATE_CREATION - 1312184567598 - - - TYPE - REPOSITORY - - - diff --git a/lab/msa_dev/resources/opt/fmc_repository/.meta_Datafiles b/lab/msa_dev/resources/opt/fmc_repository/.meta_Datafiles deleted file mode 100644 index be31b9e1..00000000 --- a/lab/msa_dev/resources/opt/fmc_repository/.meta_Datafiles +++ /dev/null @@ -1,21 +0,0 @@ - - - - - DATE_MODIFICATION - 1329294521094 - - - REPOSITORY - Datafiles - - - DATE_CREATION - 1329294521086 - - - TYPE - REPOSITORY - - - diff --git a/lab/msa_dev/resources/opt/fmc_repository/.meta_Documentation b/lab/msa_dev/resources/opt/fmc_repository/.meta_Documentation deleted file mode 100644 index b2ddbbc0..00000000 --- a/lab/msa_dev/resources/opt/fmc_repository/.meta_Documentation +++ /dev/null @@ -1,21 +0,0 @@ - - - - - DATE_MODIFICATION - 1329294521094 - - - REPOSITORY - Documentation - - - DATE_CREATION - 1329294521086 - - - TYPE - REPOSITORY - - - diff --git a/lab/msa_dev/resources/opt/fmc_repository/.meta_Firmware b/lab/msa_dev/resources/opt/fmc_repository/.meta_Firmware deleted file mode 100644 index 2fb9b05d..00000000 --- a/lab/msa_dev/resources/opt/fmc_repository/.meta_Firmware +++ /dev/null @@ -1,21 +0,0 @@ - - - - - DATE_MODIFICATION - 1329294520919 - - - REPOSITORY - Firmware - - - DATE_CREATION - 1329294520909 - - - TYPE - REPOSITORY - - - diff --git a/lab/msa_dev/resources/opt/fmc_repository/.meta_License b/lab/msa_dev/resources/opt/fmc_repository/.meta_License deleted file mode 100644 index dc924cc3..00000000 --- a/lab/msa_dev/resources/opt/fmc_repository/.meta_License +++ /dev/null @@ -1,21 +0,0 @@ - - - - - DATE_MODIFICATION - 1329294520869 - - - REPOSITORY - License - - - DATE_CREATION - 1329294520860 - - - TYPE - REPOSITORY - - - diff --git a/lab/msa_dev/resources/opt/fmc_repository/.meta_Process b/lab/msa_dev/resources/opt/fmc_repository/.meta_Process deleted file mode 100644 index 1e2e3d08..00000000 --- a/lab/msa_dev/resources/opt/fmc_repository/.meta_Process +++ /dev/null @@ -1,21 +0,0 @@ - - - - - DATE_MODIFICATION - 1303211038256 - - - REPOSITORY - CommandDefinition - - - DATE_CREATION - 1303211038135 - - - TYPE - REPOSITORY - - - \ No newline at end of file diff --git a/lab/msa_dev/resources/opt/fmc_repository/.meta_root b/lab/msa_dev/resources/opt/fmc_repository/.meta_root deleted file mode 100755 index bf49853b..00000000 --- a/lab/msa_dev/resources/opt/fmc_repository/.meta_root +++ /dev/null @@ -1,17 +0,0 @@ - - - - - DATE_MODIFICATION - 1567084262739 - - - DATE_CREATION - 1329294520268 - - - TYPE - ROOT - - - diff --git a/lab/msa_dev/resources/scripts/clean_old_topology_instances.sh b/lab/msa_dev/resources/scripts/clean_old_topology_instances.sh deleted file mode 100644 index c2e9117a..00000000 --- a/lab/msa_dev/resources/scripts/clean_old_topology_instances.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -#set -x - -PROG=$(basename $0) - -/usr/bin/wait_for_api.sh -if [ $? -ne 0 ]; then - echo "\nERROR: API unavailable" - exit 1 -fi - - -RESPONSE=`curl -s -k -H 'Content-Type: application/json' -XPOST http://msa-api:8480/ubi-api-rest/auth/token -d '{"username":"ncroot", "password":"ubiqube" }'` -if [ -z "$RESPONSE" ] -then - echo "Authentication API error" - exit 1 -fi -TOKEN=$(php -r 'echo json_decode($argv[1])->token;' "$RESPONSE") - -CUSTOMERS=`curl --location -s -k -H "Authorization: Bearer "$TOKEN -XGET http://msa-api:8480/ubi-api-rest/lookup/customers` - -CUSTOMERIDS=`echo $CUSTOMERS | grep -Eo '"ubiId"[^,]*' | grep -Eo '[^:]*$' | sed 's/"//g'` - -for CUSTOMER in ${CUSTOMERIDS} -do - INSTANCES=`curl --location -s -k -H "Authorization: Bearer "$TOKEN -XGET http://msa-api:8480/ubi-api-rest/orchestration/${CUSTOMER}/service/instance` - - INSTANCEIDS=`echo $INSTANCES | grep -Eo '"id"[^,]*' | grep -Eo '[^:]*$' | sed 's/"//g'` - - for INSTANCE in ${INSTANCEIDS} - do - INSTANCE_DETAILS=`curl --location -s -k -H "Authorization: Bearer "$TOKEN -XGET http://msa-api:8480/ubi-api-rest/orchestration/${CUSTOMER}/service/instance/${INSTANCE}` - - INSTANCE_NAME=`echo $INSTANCE_DETAILS | grep -Eo '"name"[^,]*' | grep -Eo '[^:]*$' | sed 's/"//g'` - - if [[ $INSTANCE_NAME == *"Topology"* ]]; then - - curl --location -s -k -H "Authorization: Bearer "$TOKEN -XDELETE http://msa-api:8480/ubi-api-rest/orchestration/v1/service/instance/${INSTANCE} - fi - done -done diff --git a/lab/msa_dev/resources/scripts/create_mini_lab.sh b/lab/msa_dev/resources/scripts/create_mini_lab.sh deleted file mode 100644 index 620e14f2..00000000 --- a/lab/msa_dev/resources/scripts/create_mini_lab.sh +++ /dev/null @@ -1,187 +0,0 @@ -#!/bin/bash -#set -x -USER="ncroot" -PASSWORD="ubiqube" -OPERATOR="BLR" -function executeCurl(){ - token=$1 - method=$2 - apiPath=$3 - body=$4 - echo "Token $token" - echo "Method $method" - echo "apiPath $apiPath" - echo "body $body" - res=`curl -s -H "Content-Type: application/json" -H "Authorization: Bearer "$token -X $method "http://msa-api:8480/ubi-api-rest$apiPath" -d "$body"` - echo $res -} -/usr/bin/wait_for_api.sh -if [ $? -ne 0 ]; then - echo "\nERROR: API unavailable" - exit 1 -fi -RESPONSE=`curl -s -H 'Content-Type: application/json' -XPOST http://msa-api:8480/ubi-api-rest/auth/token -d '{"username":"ncroot", "password":"ubiqube" }'` -if [ -z "$RESPONSE" ] -then - echo "Authentication API error" - exit 1 -fi -TOKEN=$(php -r 'echo json_decode($argv[1])->token;' "$RESPONSE") -echo "-------------------------------------------------------" -echo "CREATE $OPERATOR TENANT AND CUSTOMER Tyrell Corporation" -echo "-------------------------------------------------------" -tenantExist=$(executeCurl $TOKEN 'GET' "/operator/v1/exists/$OPERATOR") -if [[ $tenantExist == *"false"* ]]; then - tenant=$(executeCurl $TOKEN 'POST' "/operator/$OPERATOR?name=BladeRunner") -else - echo "$OPERATOR already exists" -fi -subTenantExist=$(executeCurl $TOKEN 'GET' "/customer/reference/TyrellCorp") -if [[ $subTenantExist == *"actorId"* ]]; then - echo "Subtenant Tyrell Corporation already exists" -else - subtenant=$(executeCurl $TOKEN 'POST' "/customer/$OPERATOR?name=Tyrell%20Corporation&reference=TyrellCorp" '{"name":"Tyrell Corporation"}') -fi -CUSTLIST=`curl -s -H "Content-Type:application/json" -H "Authorization: Bearer "$TOKEN -XGET http://msa-api:8480/ubi-api-rest/lookup/customers` -IFS='"' # set delimiter -read -ra ADDR <<< "$CUSTLIST" # str is read into an array as tokens separated by IFS -for i in "${ADDR[@]}"; do # access each element of array - if [[ $i == BLRA* ]] - then - CUSTID=$i - fi -done -echo "Subtenant ID $CUSTID" -echo "--------------------------------------------------" -echo "ATTACH WORKFLOWS TO CUSTOMER $CUSTID" -echo "--------------------------------------------------" -echo "> Self Demo Setup" -wf=$(executeCurl $TOKEN 'POST' "/orchestration/$CUSTID/service/attach?uri=Process/SelfDemoSetup/SelfDemoSetup.xml") -echo "> Simple Firewall Python" -wf=$(executeCurl $TOKEN 'POST' "/orchestration/$CUSTID/service/attach?uri=Process/Tutorials/python/Simple_Firewall/Simple_Firewall.xml") -echo "> Security Event Detection" -wf=$(executeCurl $TOKEN 'POST' "/orchestration/$CUSTID/service/attach?uri=Process/Tutorials/alarm/Alarm_Action/Alarm_Action.xml") -echo "> Dashboard Deployment" -wf=$(executeCurl $TOKEN 'POST' "/orchestration/$CUSTID/service/attach?uri=Process/Analytics/Kibana/kibana_dashboard.xml") -echo "--------------------------------------------------" -echo "CREATE DEMO DEVICES" -echo "--------------------------------------------------" -CUSTIDONLY=${CUSTID//BLRA} -PID1RAW=$(executeCurl $TOKEN 'POST' "/orchestration/service/execute/$CUSTID/?serviceName=Process/SelfDemoSetup/SelfDemoSetup&processName=Process%2FSelfDemoSetup%2FProcess_Setup" '{"manufacturer_id": "14020601", "password": "ubiqube", "snmpCommunity": "ubiqube", "password_admin": "aaaa", "managementInterface": "eth0", "managed_device_name": "linux_me", "model_id": "14020601", "device_ip_address": "172.20.0.101", "login": "msa", "hostname": "linux_me"}') -sleep 1 -PID2RAW=$(executeCurl $TOKEN 'POST' "/orchestration/service/execute/$CUSTID/?serviceName=Process/SelfDemoSetup/SelfDemoSetup&processName=Process%2FSelfDemoSetup%2FProcess_Setup" '{"manufacturer_id": "14020601", "password": "ubiqube", "snmpCommunity": "ubiqube", "password_admin": "aaaa", "managementInterface": "eth0", "managed_device_name": "linux_me_2", "model_id": "14020601", "device_ip_address": "172.20.0.102", "login": "msa", "hostname": "linux_me_2" }') -reg='processInstanceId\s?:([0-9]+),' -[[ $PID1RAW =~ $reg ]] -PID_1=${BASH_REMATCH[1]} -[[ $PID2RAW =~ $reg ]] -PID_2=${BASH_REMATCH[1]} -#echo "PIDS : $PID_1, $PID_2" -sleep 5 -ME1RAW=$(executeCurl $TOKEN 'GET' "/orchestration/v1/process-instance/$PID_1") -ME2RAW=$(executeCurl $TOKEN 'GET' "/orchestration/v1/process-instance/$PID_2") - -reg='entites.exceptions.MAX_SITE_REACHED' -if [[ $ME1RAW =~ $reg ]];then - echo "Warning : Not possible to create managed entities. Please check your license" - exit 1 -fi - -reg='.*(BLR[0-9]+)' -[[ $ME1RAW =~ $reg ]] -ME1ID=${BASH_REMATCH[1]} -[[ $ME2RAW =~ $reg ]] -ME2ID=${BASH_REMATCH[1]} -echo "ME IDS : $ME1ID , $ME2ID" -echo "-----------------------------------------------------" -echo "CREATE MONITORING PROFILE AND ATTACH MANAGED ENTITIES" -echo "-----------------------------------------------------" -pflExist=$(executeCurl $TOKEN 'POST' "/profile/v1/exist/TyrellMonitoringPfl") -if [[ $pflExist == *"false"* ]]; then - pfl=$(executeCurl $TOKEN 'POST' "/profile/monitoring-profile/$CUSTIDONLY" '{"name":"Linux","externalReference": "TyrellMonitoringPfl","comment":"TyrellMonitoringPfl","graphRendererList":[{"id":0,"profileId":0,"name":"CPU","verticalLabel":"Percent","dataList":[{"horizontalLabel":"1 min","color":"#d33115","profileId":0,"rendererId":0,"snmpPollingData":null,"snmpPollingId":0},{"horizontalLabel":"5 min","color":"#dbdf00","profileId":0,"rendererId":0,"snmpPollingData":null,"snmpPollingId":1},{"horizontalLabel":"15 min","color":"#16a5a5","profileId":0,"rendererId":0,"snmpPollingData":null,"snmpPollingId":2}]},{"id":1,"profileId":0,"name":"Memory","verticalLabel":"kB","dataList":[{"horizontalLabel":"avail","color":"#fe9200","profileId":0,"rendererId":0,"snmpPollingData":null,"snmpPollingId":3},{"horizontalLabel":"totall free","color":"#dbdf00","profileId":0,"rendererId":0,"snmpPollingData":null,"snmpPollingId":4},{"horizontalLabel":"shared","color":"#68ccca","profileId":0,"rendererId":0,"snmpPollingData":null,"snmpPollingId":5},{"horizontalLabel":"buffer","color":"#aea1ff","profileId":0,"rendererId":0,"snmpPollingData":null,"snmpPollingId":6},{"horizontalLabel":"cached","color":"#fa28ff","profileId":0,"rendererId":0,"snmpPollingData":null,"snmpPollingId":7},{"horizontalLabel":"total real","color":"#653294","profileId":0,"rendererId":0,"snmpPollingData":null,"snmpPollingId":8}]},{"id":2,"profileId":0,"name":"Traffic","verticalLabel":"KPS","dataList":[{"horizontalLabel":"IN","color":"#68ccca","profileId":0,"rendererId":0,"snmpPollingData":null,"snmpPollingId":9},{"horizontalLabel":"OUT","color":"#fcdc00","profileId":0,"rendererId":0,"snmpPollingData":null,"snmpPollingId":10}]}],"snmpPollingList":[{"id":0,"name":"cpu_load_1min","oid":"1.3.6.1.4.1.2021.10.1.5.1","pollingType":"G","minValue":0,"maxValue":-1,"comment":"","thresholdComparator":"G","threshold":60,"thresholdFrequency":"M","profileId":0,"pollingPeriod":1},{"id":1,"name":"cpu_load_5min","oid":"1.3.6.1.4.1.2021.10.1.5.2","pollingType":"G","minValue":0,"maxValue":-1,"comment":"","thresholdComparator":"G","threshold":70,"thresholdFrequency":"M","profileId":0,"pollingPeriod":1},{"id":2,"name":"cpu_load_15min","oid":"1.3.6.1.4.1.2021.10.1.5.3","pollingType":"G","minValue":0,"maxValue":-1,"comment":"","thresholdComparator":"G","threshold":80,"thresholdFrequency":"M","profileId":0,"pollingPeriod":1},{"id":3,"name":"memAvailReal","oid":".1.3.6.1.4.1.2021.4.6.0","pollingType":"G","minValue":0,"maxValue":-1,"comment":"","thresholdComparator":"L","threshold":0,"thresholdFrequency":"M","profileId":0,"pollingPeriod":1},{"id":4,"name":"memTotalFree","oid":".1.3.6.1.4.1.2021.4.11.0","pollingType":"G","minValue":0,"maxValue":-1,"comment":"","thresholdComparator":"L","threshold":0,"thresholdFrequency":"M","profileId":0,"pollingPeriod":1},{"id":5,"name":"memShared","oid":".1.3.6.1.4.1.2021.4.13.0","pollingType":"G","minValue":0,"maxValue":-1,"comment":"","thresholdComparator":"L","threshold":0,"thresholdFrequency":"M","profileId":0,"pollingPeriod":1},{"id":6,"name":"memBuffer","oid":".1.3.6.1.4.1.2021.4.14.0","pollingType":"G","minValue":0,"maxValue":-1,"comment":"","thresholdComparator":"L","threshold":0,"thresholdFrequency":"M","profileId":0,"pollingPeriod":1},{"id":7,"name":"memCached","oid":".1.3.6.1.4.1.2021.4.15.0","pollingType":"G","minValue":0,"maxValue":-1,"comment":"","thresholdComparator":"L","threshold":0,"thresholdFrequency":"M","profileId":0,"pollingPeriod":1},{"id":8,"name":"memTotalReal","oid":".1.3.6.1.4.1.2021.4.5.0","pollingType":"G","minValue":0,"maxValue":-1,"comment":"","thresholdComparator":"L","threshold":0,"thresholdFrequency":"M","profileId":0,"pollingPeriod":1},{"id":9,"name":"eth0 IN","oid":"1.3.6.1.2.1.2.2.1.10.2","pollingType":"C","minValue":0,"maxValue":-1,"comment":"","thresholdComparator":"L","threshold":0,"thresholdFrequency":"M","profileId":0,"pollingPeriod":1},{"id":10,"name":"eth0 OUT","oid":"1.3.6.1.2.1.2.2.1.16.2","pollingType":"C","minValue":0,"maxValue":-1,"comment":"","thresholdComparator":"L","threshold":0,"thresholdFrequency":"M","profileId":0,"pollingPeriod":1}]}') -else - echo "Monitoring profile already exists" -fi -at1=$(executeCurl $TOKEN 'PUT' "/profile/TyrellMonitoringPfl/attach?device=$ME1ID") -at2=$(executeCurl $TOKEN 'PUT' "/profile/TyrellMonitoringPfl/attach?device=$ME2ID") -echo "-----------------------------------------------------" -echo "CREATE AND CONFIGURE DASHBOARD" -echo "-----------------------------------------------------" -dashboardExist=$(executeCurl $TOKEN 'GET' "/orchestration/v1/summary/actor?customerId=$CUSTIDONLY") -if [[ $dashboardExist == *"kibana_dashboard"* ]]; then - echo "Dashboard already exists" -else - DASH_RAW=$(executeCurl $TOKEN 'POST' "/orchestration/service/execute/$CUSTID?serviceName=Process%2FAnalytics%2FKibana%2Fkibana_dashboard&processName=Process%2FAnalytics%2FKibana%2FProcess_Create_Report_Dashboard" '{"ipAddress":null,"basePath":"/kibana","index":".kibana","type":"dashboard","template_id":"template_default","dashboardName":"MiniLabDashboard","searchingURI":null,"uriPutES":null,"Hash":null,"kibanaUrl":null,"kibanaPort":"5601","kibanaIpAddress":null}') - reg='.*SID([0-9]+)' - [[ $DASH_RAW =~ $reg ]] - DASH_SERVICEID=${BASH_REMATCH[1]} - #echo "Sevice ID $DASH_SERVICEID" - sleep 3 - HASH_RAW=$(executeCurl $TOKEN 'GET' "/orchestration/service/variables/$DASH_SERVICEID/Hash") - reg='.*ash\s+:\s+(\w+)' - [[ $HASH_RAW =~ $reg ]] - HASH=${BASH_REMATCH[1]} - #echo "KIB HAS $HASH" - body='{"content":{"language":"en","drawerWidth":{"automationDetail":600},"tableRows":{"dashboard":12,"managedEntities":10,"automation":10,"configurations":10,"admin":10,"logs":10,"alarms":10,"monitoringProfiles":10,"permissionProfiles":10,"bpmOverview":10,"bpmDetails":10,"profileAuditLogs":10,"aiStates":10},"autoRefresh":60000,"dashboard":[{"style":"Dashboard Panel","type":"MSA Component","component":"Managed Entity Status","title":"Infrastructure","lg":6,"height":120},{"style":"Dashboard Panel","type":"MSA Component","component":"Automation","title":"Automation","lg":6,"height":120},{"style":"Dashboard Panel","type":"MSA Component","component":"Kibana Dashboard","title":"Dashboard","lg":12,"height":120,"extendedListValues":{"kibanaUrl":""}}]}}' - body=${body//$HASH} - #echo "BODY $body" - #executeCurl $TOKEN 'PUT' "/repository/file?uri=Datafiles/.NCLG1_UI_SETTINGS.json" \'"$body"\' - settings=$(executeCurl $TOKEN 'PUT' "/repository/file?uri=Datafiles/.NCLG1_UI_SETTINGS.json" ' - { - "content": { - "language": "en", - "drawerWidth": { - "automationDetail": 600 - }, - "tableRows": { - "dashboard": 12, - "managedEntities": 10, - "automation": 10, - "configurations": 10, - "admin": 10, - "logs": 10, - "alarms": 10, - "monitoringProfiles": 10, - "permissionProfiles": 10, - "bpmOverview": 10, - "bpmDetails": 10, - "profileAuditLogs": 10, - "aiStates": 10 - }, - "tableSortKey": { "automation": "lastupdated" }, - "tableSortOrder": { "automation": 0 }, - "autoRefresh": { // This is the right one - "managedEntityStatus": 60, - "ping": 5, - "notification": 60, - "pollingInterval": 2, - "topology": 30 - }, - "dashboard": [{ - "style": "Dashboard Panel", - "type": "MSA Component", - "component": "Managed Entity Status", - "title": "Infrastructure", - "lg": 6, - "height": 120 - }, { - "style": "Dashboard Panel", - "type": "MSA Component", - "component": "Automation", - "title": "Automation", - "lg": 6, - "height": 120 - }, { - "style": "Dashboard Panel", - "type": "MSA Component", - "component": "Kibana Dashboard", - "title": "Dashboard", - "lg": 12, - "height": 120, - "extendedListValues": { - "kibanaUrl": "'"$HASH"'" - } - }] - } - } - ') -fi diff --git a/lab/msa_dev/resources/scripts/create_test_me.sh b/lab/msa_dev/resources/scripts/create_test_me.sh deleted file mode 100644 index 5e841525..00000000 --- a/lab/msa_dev/resources/scripts/create_test_me.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -#set -x - -###################################################################################### -# This script is only meant to be used as a test script to create a ME for each vendor -###################################################################################### - -USER="ncroot" -PASSWORD="ubiqube" -OPERATOR="TST" -OPERATOR_NAME="my_tenant" - -MAN_ID=$1 -MOD_ID=$2 -ME_NAME=$3 - - -RESPONSE=`curl -s -H 'Content-Type: application/json' -XPOST http://msa-api:8480/ubi-api-rest/auth/token -d '{"username":"ncroot", "password":"ubiqube" }'` -if [ -z "$RESPONSE" ] -then - echo "Authentication API error" - exit 1 -fi -TOKEN=$(php -r 'echo json_decode($argv[1])->token;' "$RESPONSE") - -echo "-------------------------------------------------------" -echo "CREATE $OPERATOR TENANT AND CUSTOMER my_subtenant" -echo "-------------------------------------------------------" - -curl -s -H "Content-Type: application/json" -H "Authorization: Bearer "$TOKEN -XPOST "http://msa-api:8480/ubi-api-rest/operator/$OPERATOR?name=$OPERATOR_NAME" -echo -curl -s -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer $TOKEN" -XPOST "http://msa-api:8480/ubi-api-rest/customer/$OPERATOR?name=my_subtenant&reference=my_subtenant" -d '{"name":"my_subtenant"}' -echo -CUSTLIST=`curl -s -H "Content-Type:application/json" -H "Authorization: Bearer "$TOKEN -XGET http://msa-api:8480/ubi-api-rest/lookup/customers` - -IFS='"' # set delimiter -read -ra ADDR <<< "$CUSTLIST" # str is read into an array as tokens separated by IFS -for i in "${ADDR[@]}"; do # access each element of array - if [[ $i == TSTA* ]] - then - CUSTID=$i - fi -done - -echo $CUSTID - - -echo "--------------------------------------------------" -echo "ATTACH WORKFLOWS TO CUSTOMER $CUSTID" -echo "--------------------------------------------------" - -curl -s -H "Content-Type: application/json" -H "Authorization: Bearer "$TOKEN -XPOST "http://msa-api:8480/ubi-api-rest/orchestration/$CUSTID/service/attach?uri=Process/SelfDemoSetup/SelfDemoSetup.xml" - - - -echo "--------------------------------------------------" -echo "CREATE DEMO DEVICES" -echo "--------------------------------------------------" -CUSTIDONLY=${CUSTID//BLRA} - - - -curl -s -H "Content-Type: application/json" -H "Authorization: Bearer "$TOKEN -XPOST "http://msa-api:8480/ubi-api-rest/orchestration/service/execute/status/$CUSTID/?serviceName=Process/SelfDemoSetup/SelfDemoSetup&processName=Process%2FSelfDemoSetup%2FCreate_ME" \ - -d '{ "manufacturer_id": "14020601", "password": "ubiqube", "login": "msa", "snmpCommunity": "ubiqube", "password_admin": "aaaa", "managementInterface": "eth0", "managed_device_name": "linux_me_1", "model_id": "14020601", "device_ip_address": "172.20.0.121", }' - -curl -s -H "Content-Type: application/json" -H "Authorization: Bearer "$TOKEN -XPOST "http://msa-api:8480/ubi-api-rest/orchestration/service/execute/status/$CUSTID/?serviceName=Process/SelfDemoSetup/SelfDemoSetup&processName=Process%2FSelfDemoSetup%2FCreate_ME" \ - -d '{ "manufacturer_id": "14020601", "password": "ubiqube", "login": "msa", "snmpCommunity": "ubiqube", "password_admin": "aaaa", "managementInterface": "eth0", "managed_device_name": "linux_me_2", "model_id": "14020601", "device_ip_address": "172.20.0.122", }' - -curl -s -H "Content-Type: application/json" -H "Authorization: Bearer "$TOKEN -XPOST "http://msa-api:8480/ubi-api-rest/orchestration/service/execute/status/$CUSTID/?serviceName=Process/SelfDemoSetup/SelfDemoSetup&processName=Process%2FSelfDemoSetup%2FCreate_ME" \ - -d '{ "manufacturer_id": "14020601", "password": "ubiqube", "login": "msa", "snmpCommunity": "ubiqube", "password_admin": "aaaa", "managementInterface": "eth0", "managed_device_name": "linux_me_3", "model_id": "14020601", "device_ip_address": "172.20.0.123", }' - diff --git a/lab/msa_dev/resources/scripts/install_libraries.sh b/lab/msa_dev/resources/scripts/install_libraries.sh deleted file mode 100644 index eaf45b6b..00000000 --- a/lab/msa_dev/resources/scripts/install_libraries.sh +++ /dev/null @@ -1,555 +0,0 @@ -#!/bin/bash -#set -x - -PROG=$(basename $0) - -DEV_BRANCH=default_dev_branch -GITHUB_DEFAULT_BRANCH=master -QUICKSTART_DEFAULT_BRANCH=master -INSTALL_LICENSE=false -ASSUME_YES=false - -# -# versioning of the libraries that are installed by the script -# -TAG_WF_KIBANA_DASHBOARD=v2.8.4 # https://github.com/openmsa/workflow_kibana -TAG_WF_TOPOLOGY=v2.8.6 # https://github.com/openmsa/workflow_topology -TAG_PHP_SDK=v2.6.0 # https://github.com/openmsa/php-sdk -TAG_WF_MINILAB=v2.6.0 # https://github.com/ubiqube/workflow_quickstart_minilab -TAG_PYTHON_SDK=v2.8.5 # https://github.com/openmsa/python-sdk -TAG_WF_ETSI_MANO=v3.0.0 # https://github.com/openmsa/etsi-mano-workflows -TAG_ADAPTER=v2.8.6 # https://github.com/openmsa/Adapters -TAG_WORKFLOWS=v2.8.5 # https://github.com/openmsa/Workflows -TAG_MICROSERVICES=v2.8.6 # https://github.com/openmsa/Microservices -TAG_BLUEPRINTS=CCLA-2.0.0 # https://github.com/openmsa/Blueprints - - -install_license() { - - if [ $INSTALL_LICENSE == true ]; - then - echo "-------------------------------------------------------" - echo "INSTALL EVAL LICENSE" - echo "-------------------------------------------------------" - /usr/bin/install_license.sh - if [ $? -ne 0 ]; then - exit 1 - fi - fi -} - -init_intall() { - - git config --global alias.lg "log --graph --pretty=format:'%C(red)%h%C(reset) -%C(yellow)%d%C(reset) %s %C(bold blue)<%an>%C(reset) %C(green)(%ar)%C(reset)' --abbrev-commit --date=relative"; - git config --global push.default simple; - git config --global pull.rebase false; - mkdir -p /opt/fmc_entities; - mkdir -p /opt/fmc_repository/CommandDefinition; - mkdir -p /opt/fmc_repository/CommandDefinition/microservices; - mkdir -p /opt/fmc_repository/Configuration; - mkdir -p /opt/fmc_repository/Datafiles; - mkdir -p /opt/fmc_repository/Datafiles/Environments; - mkdir -p /opt/fmc_repository/Documentation; - mkdir -p /opt/fmc_repository/Firmware; - mkdir -p /opt/fmc_repository/License; - mkdir -p /opt/fmc_repository/Process; - mkdir -p /opt/fmc_repository/Blueprints; - mkdir -p /opt/fmc_repository/Blueprints/local; - - chown -R ncuser.ncuser /opt/fmc_repository /opt/fmc_entities -} - -update_git_repo () { - REPO_URL=$1 - REPO_BASE_DIR=$2 - REPO_DIR=$3 - DEFAULT_BRANCH=$4 - DEFAULT_DEV_BRANCH=$5 - TAG=$6 - RESET_REPO=$7 - - cd $REPO_BASE_DIR - echo ">> " - echo ">> $REPO_URL" - if [ "$RESET_REPO" == true ]; - then - echo "> deleting repository" - rm -rf $REPO_DIR - fi - - if [ -d $REPO_DIR ]; - then - cd $REPO_DIR - ## get current branch and store in variable CURRENT_BR - CURRENT_BR=`git rev-parse --abbrev-ref HEAD` - echo "> Current working branch: $CURRENT_BR" - if [[ $ASSUME_YES == false && "$CURRENT_BR" == "master" ]]; - then - echo "> WARNING: your current branch is $CURRENT_BR, to be safe, you may want to switch to a working branch (default_dev_branch is the factory default for development) > switch ? [y]/[N]" - read yn - case $yn in - [Yy]* ) - echo "> Enter the name of the working branch (enter $CURRENT_BR to stay on your current branch):" - read br - if [ -z "$br" ]; - then - echo "> ERROR: invalid branch name, exiting..." - exit 0 - else - # checkout or create and checkout the branch - echo "> Switching to $br (the branch will be created if it doesn't exist yet)" - git checkout $br 2>/dev/null || git checkout -b $br - CURRENT_BR=$br - fi - ;; - [Nn]* ) - echo "> stay on master ? [y]/[N]" - read resp - if [[ ! -z "$resp" && "$resp" == "y" ]]; - then - echo "> running installation/update on master branch on local repository" - else - echo "> cancelling installation, exiting... " - exit 0 - fi - ;; - * ) - echo "> exiting... " - exit 0 - ;; - esac - fi - - if [[ $ASSUME_YES == false && ! -z "$TAG" ]]; - then - echo "> installing version $TAG for $REPO_DIR" - echo "> available release branches" - git branch --list v* - git fetch --tags - echo "> available release tags:" - git tag -l v* - if [ ! `git tag --list $TAG` ] - then - echo "> WARNING: tag $TAG not found, current branch is $CURRENT_BR" - echo "> (c) Cancel installation" - echo "> (I) Ignore and keep existing version - default" - read -p "[I]/[c]" resp - if [[ $resp != "" && $resp == "c" ]]; - then - echo "> cancelling installation, exiting... " - exit 0 - fi - fi - git stash - git checkout master - git pull - if [ `git branch --list $TAG` ] - then - echo "> local branch $branch_name already exists." - echo "> delete the local branch created for the tag $TAG" - git branch -D $TAG - fi - echo "> Create a new branch: $TAG based on the tag $TAG" - git checkout tags/$TAG -b $TAG - elif [[ $ASSUME_YES == false && ! -z "$DEFAULT_BRANCH" ]]; - then - git stash - echo "> Checking merge $DEFAULT_BRANCH to $CURRENT_BR" - git merge --no-commit --no-ff $DEFAULT_BRANCH - CAN_MERGE=$? - if [ $CAN_MERGE == 0 ]; - then - echo "> Auto-merge $DEFAULT_BRANCH to $CURRENT_BR is possible" - if [ $ASSUME_YES == false ]; - then - while true; do - - echo "> merge $DEFAULT_BRANCH to current working branch $CURRENT_BR ? [y]/[N]" - read yn - - case $yn in - [Yy]* ) - git pull origin $DEFAULT_BRANCH --prune; break - ;; - [Nn]* ) - echo "> skip merge " - break - ;; - * ) - echo "Please answer yes or no." - ;; - esac - done - else - git pull origin $DEFAULT_BRANCH --prune - fi - else - echo "> ERROR: conflict found when merging $DEFAULT_BRANCH to $CURRENT_BR." - echo "> auto-merge not possible" - echo "> login to the container msa_dev and merge manually if merge is needed" - echo "> relaunch install_libraries after merge is done" - echo "> git repository at $REPO_BASE_DIR/$REPO_DIR" - git merge --abort - exit 1 - fi; - echo "> Check out $DEFAULT_BRANCH and get the latest code" - git checkout $DEFAULT_BRANCH; - git pull; - echo "> Back to working branch" - git checkout $CURRENT_BR - git stash pop - fi; - else - git clone $REPO_URL $REPO_DIR - cd $REPO_DIR - git checkout $DEFAULT_BRANCH; - if [ ! -z "$TAG" ]; - then - echo "> Create a new branch: $TAG based on the tag $TAG" - git checkout tags/$TAG -b $TAG - fi - - if [ ! -z "$DEFAULT_DEV_BRANCH" ]; - then - echo "> Create a new developement branch: $DEFAULT_DEV_BRANCH based on $DEFAULT_BRANCH" - git checkout -b $DEFAULT_DEV_BRANCH - fi - fi; - echo ">>" - echo ">> DONE" -} - -update_all_github_repo() { - echo "-------------------------------------------------------------------------------" - echo " Update the github repositories " - echo "-------------------------------------------------------------------------------" - install_type=$1 - git config --global user.email devops@openmsa.co - - if [[ $install_type = "all" || $install_type = "da" ]]; - then - update_git_repo "https://github.com/openmsa/Adapters.git" "/opt/devops" "OpenMSA_Adapters" $GITHUB_DEFAULT_BRANCH "" $TAG_ADAPTER false - fi - - if [[ $install_type = "all" || $install_type = "ms" ]]; - then - update_git_repo "https://github.com/openmsa/Microservices.git" "/opt/fmc_repository" "OpenMSA_MS" $GITHUB_DEFAULT_BRANCH "" $TAG_MICROSERVICES false - fi - - if [[ $install_type = "all" || $install_type = "wf" ]]; - then - update_git_repo "https://github.com/openmsa/workflow_kibana.git" "/opt/fmc_repository" "OpenMSA_Workflow_Kibana" $GITHUB_DEFAULT_BRANCH "" $TAG_WF_KIBANA_DASHBOARD false - update_git_repo "https://github.com/openmsa/workflow_topology.git" "/opt/fmc_repository" "OpenMSA_Workflow_Topology" $GITHUB_DEFAULT_BRANCH "" $TAG_WF_TOPOLOGY false - update_git_repo "https://github.com/openmsa/Workflows.git" "/opt/fmc_repository" "OpenMSA_WF" $GITHUB_DEFAULT_BRANCH "" $TAG_WORKFLOWS false - update_git_repo "https://github.com/openmsa/php-sdk.git" "/opt/fmc_repository" "php_sdk" $GITHUB_DEFAULT_BRANCH "" $TAG_PHP_SDK false - update_git_repo "https://github.com/ubiqube/workflow_quickstart_minilab.git" "/opt/fmc_repository" "workflow_quickstart_minilab" $GITHUB_DEFAULT_BRANCH "" $TAG_WF_MINILAB true - fi - - if [[ $install_type = "all" || $install_type = "mano" ]]; - then - update_git_repo "https://github.com/openmsa/etsi-mano-workflows.git" "/opt/fmc_repository" "etsi-mano-workflows" $GITHUB_DEFAULT_BRANCH "" $TAG_WF_ETSI_MANO false - fi - - if [[ $install_type = "ccla" ]]; - then - update_git_repo "https://github.com/openmsa/Blueprints" "/opt/fmc_repository" "OpenMSA_Blueprints" $GITHUB_DEFAULT_BRANCH "" $TAG_BLUEPRINTS false - fi - - if [[ $install_type = "all" || $install_type = "py" ]]; - then - update_git_repo "https://github.com/openmsa/python-sdk.git" "/tmp/" "python_sdk" "develop" "" $TAG_PYTHON_SDK false - fi - -# if [[ $install_type = "all" || $install_type = "quickstart" ]]; -# then -# update_git_repo "https://github.com/ubiqube/quickstart.git" "/opt/fmc_repository" "quickstart" $QUICKSTART_DEFAULT_BRANCH "" "" true -# fi -} - -install_python_sdk() { - echo "-------------------------------------------------------------------------------" - echo " Install python SDK" - echo "-------------------------------------------------------------------------------" - mkdir -p /opt/fmc_repository/Process/PythonReference/custom - touch /opt/fmc_repository/Process/PythonReference/custom/__init__.py - pushd /tmp/python_sdk - python3 setup.py -q install --install-lib='/opt/fmc_repository/Process/PythonReference' - popd - rm -rf /tmp/python_sdk -} - -install_microservices () { - - echo "-------------------------------------------------------------------------------" - echo " Install some MS from OpenMSA github repo" - echo "-------------------------------------------------------------------------------" - cd /opt/fmc_repository/CommandDefinition/; - echo " >> ADVA" - ln -fsn ../OpenMSA_MS/ADVA ADVA; ln -fsn ../OpenMSA_MS/.meta_ADVA .meta_ADVA; - echo " >> ANSIBLE" - ln -fsn ../OpenMSA_MS/ANSIBLE ANSIBLE; ln -fsn ../OpenMSA_MS/.meta_ANSIBLE .meta_ANSIBLE; - echo " >> AWS" - ln -fsn ../OpenMSA_MS/AWS AWS; ln -fsn ../OpenMSA_MS/.meta_AWS .meta_AWS; - echo " >> CHECKPOINT" - ln -fsn ../OpenMSA_MS/CHECKPOINT CHECKPOINT; ln -fsn ../OpenMSA_MS/.meta_CHECKPOINT .meta_CHECKPOINT; - echo " >> CISCO" - ln -fsn ../OpenMSA_MS/CISCO CISCO; ln -fsn ../OpenMSA_MS/.meta_CISCO .meta_CISCO; - echo " >> CITRIX" - ln -fsn ../OpenMSA_MS/CITRIX CITRIX; ln -fsn ../OpenMSA_MS/.meta_CITRIX .meta_CITRIX; - echo " >> FLEXIWAN" - ln -fsn ../OpenMSA_MS/FLEXIWAN FLEXIWAN; ln -fsn ../OpenMSA_MS/.meta_FLEXIWAN .meta_FLEXIWAN; - echo " >> FORTINET" - ln -fsn ../OpenMSA_MS/FORTINET FORTINET; ln -fsn ../OpenMSA_MS/.meta_FORTINET .meta_FORTINET; - echo " >> JUNIPER" - ln -fsn ../OpenMSA_MS/JUNIPER JUNIPER; ln -fsn ../OpenMSA_MS/.meta_JUNIPER .meta_JUNIPER; - rm -rf JUNIPER/SSG - echo " >> LINUX" - ln -fsn ../OpenMSA_MS/LINUX LINUX; ln -fsn ../OpenMSA_MS/.meta_LINUX .meta_LINUX; - echo " >> MIKROTIK" - ln -fsn ../OpenMSA_MS/MIKROTIK MIKROTIK; ln -fsn ../OpenMSA_MS/.meta_MIKROTIK .meta_MIKROTIK; - echo " >> OPENSTACK" - ln -fsn ../OpenMSA_MS/OPENSTACK OPENSTACK; ln -fsn ../OpenMSA_MS/.meta_OPENSTACK .meta_OPENSTACK; - echo " >> ONEACCESS" - ln -fsn ../OpenMSA_MS/ONEACCESS ONEACCESS; ln -fsn ../OpenMSA_MS/.meta_ONEACCESS .meta_ONEACCESS; - echo " >> PALOALTO" - ln -fsn ../OpenMSA_MS/PALOALTO PALOALTO; ln -fsn ../OpenMSA_MS/.meta_PALOALTO .meta_PALOALTO; - echo " >> PFSENSE" - ln -fsn ../OpenMSA_MS/PFSENSE PFSENSE; ln -fsn ../OpenMSA_MS/.meta_PFSENSE .meta_PFSENSE; - echo " >> REDFISHAPI" - ln -fsn ../OpenMSA_MS/REDFISHAPI REDFISHAPI; ln -fsn ../OpenMSA_MS/.meta_REDFISHAPI .meta_REDFISHAPI; - echo " >> REST" - ln -fsn ../OpenMSA_MS/REST REST; ln -fsn ../OpenMSA_MS/.meta_REST .meta_REST; - echo " >> ETSI-MANO" - ln -fsn ../OpenMSA_MS/NFVO NFVO; ln -fsn ../OpenMSA_MS/.meta_NFVO .meta_NFVO - ln -fsn ../OpenMSA_MS/VNFM VNFM; ln -fsn ../OpenMSA_MS/.meta_VNFM .meta_VNFM - ln -fsn ../OpenMSA_MS/KUBERNETES KUBERNETES; ln -fsn ../OpenMSA_MS/.meta_KUBERNETES .meta_KUBERNETES - echo " >> NETBOX" - ln -fsn ../OpenMSA_MS/NETBOX NETBOX; ln -fsn ../OpenMSA_MS/.meta_NETBOX .meta_NETBOX; - echo " >> DELL/REDFISH" - ln -fsn ../OpenMSA_MS/DELL DELL; ln -fsn ../OpenMSA_MS/.meta_DELL .meta_DELL; - echo " >> INTEL/REDFISH" - ln -fsn ../OpenMSA_MS/INTEL INTEL; ln -fsn ../OpenMSA_MS/.meta_INTEL .meta_INTEL; - echo " >> HP/REDFISH" - ln -fsn ../OpenMSA_MS/HP HP; ln -fsn ../OpenMSA_MS/.meta_HP .meta_HP; - echo " >> LANNER/IPMI" - ln -fsn ../OpenMSA_MS/LANNER LANNER; ln -fsn ../OpenMSA_MS/.meta_LANNER .meta_LANNER; - echo " >> MONITORING/GENERIC" - ln -fsn ../OpenMSA_MS/ASSURANCE ASSURANCE; - - echo "DONE" - -} - -install_workflows() { - - echo "-------------------------------------------------------------------------------" - echo " Install Workflows from OpenMSA github github repository" - echo "-------------------------------------------------------------------------------" - cd /opt/fmc_repository/Process; - echo " >> WF references and libs" - ln -fsn ../php_sdk/Reference Reference; - ln -fsn ../php_sdk/.meta_Reference .meta_Reference; - echo " >> WF tutorials" - ln -fsn ../OpenMSA_WF/Tutorials Tutorials; - ln -fsn ../OpenMSA_WF/.meta_Tutorials .meta_Tutorials; -# echo " >> BIOS_Automation" -# ln -fsn ../OpenMSA_WF/BIOS_Automation BIOS_Automation -# ln -fsn ../OpenMSA_WF/.meta_BIOS_Automation .meta_BIOS_Automation - echo " >> ETSI-MANO $TAG_WF_ETSI_MANO" - ln -fsn ../etsi-mano-workflows etsi-mano-workflows - echo " >> Private Cloud - Openstack" - ln -fsn ../OpenMSA_WF/Private_Cloud Private_Cloud - ln -fsn ../OpenMSA_WF/.meta_Private_Cloud .meta_Private_Cloud - echo " >> Ansible" - ln -fsn ../OpenMSA_WF/Ansible_integration Ansible_integration - #ln -fsn ../OpenMSA_WF/.meta_Ansible_integration .meta_Ansible_integration - echo " >> Public Cloud - AWS" - ln -fsn ../OpenMSA_WF/Public_Cloud Public_Cloud - ln -fsn ../OpenMSA_WF/.meta_Public_Cloud .meta_Public_Cloud - echo " >> Topology $TAG_WF_TOPOLOGY" - ln -fsn ../OpenMSA_Workflow_Topology/Topology Topology - ln -fsn ../OpenMSA_Workflow_Topology/.meta_Topology .meta_Topology - echo " >> Analytics $TAG_WF_KIBANA_DASHBOARD" - ln -fsn ../OpenMSA_Workflow_Kibana/Analytics Analytics - ln -fsn ../OpenMSA_Workflow_Kibana/.meta_Analytics .meta_Analytics - echo " >> MSA / Utils" - ln -fsn ../OpenMSA_WF/Utils/Manage_Device_Conf_Variables Manage_Device_Conf_Variables - ln -fsn ../OpenMSA_WF/Utils/.meta_Manage_Device_Conf_Variables .meta_Manage_Device_Conf_Variables -# echo " >> MSA / Utils" -# ln -fsn ../OpenMSA_WF/BIOS_Automation BIOS_Automation -# ln -fsn ../OpenMSA_WF/.meta_BIOS_Automation .meta_BIOS_Automation -# echo " >> AI ML Upgrade MSA" -# ln -fsn ../OpenMSA_WF/Upgrade_MSActivator Upgrade_MSActivator -# ln -fsn ../OpenMSA_WF/.meta_Upgrade_MSActivator .meta_Upgrade_MSActivator - - - echo "-------------------------------------------------------------------------------" - echo " Install mini lab setup WF from quickstart github repository" - echo "-------------------------------------------------------------------------------" - echo " >> SelfDemoSetup" - ln -fsn ../workflow_quickstart_minilab/SelfDemoSetup SelfDemoSetup; - ln -fsn ../workflow_quickstart_minilab/.meta_SelfDemoSetup .meta_SelfDemoSetup; - - echo "DONE" - -} - -install_mano_workflows() { - - echo "-------------------------------------------------------------------------------" - echo " Install MANO Workflows from OpenMSA github repository" - echo "-------------------------------------------------------------------------------" - cd /opt/fmc_repository/Process; - echo " >> WF references and libs" - ln -fsn ../php_sdk/Reference Reference; - ln -fsn ../php_sdk/.meta_Reference .meta_Reference; - echo " >> ETSI-MANO $TAG_WF_ETSI_MANO" - ln -fsn ../etsi-mano-workflows etsi-mano-workflows - - echo "DONE" - -} - -install_ccla_lib() { - - echo "-------------------------------------------------------------------------------" - echo " Install Cloudclapp library from OpenMSA github repository" - echo "-------------------------------------------------------------------------------" - - cd /opt/fmc_repository/Blueprints; - echo " >> CCLA references and libs" - ln -fsn ../OpenMSA_Blueprints/Catalog Catalog; - echo "DONE" -} - -finalize_install() { - echo "-------------------------------------------------------------------------------" - echo " update file owner to ncuser.ncuser" - echo "-------------------------------------------------------------------------------" - chown -R ncuser:ncuser /opt/fmc_repository/*; - if [[ "$install_type" = "all" || "$install_type" = "da" ]]; then - chown -R ncuser.ncuser /opt/devops/OpenMSA_Adapters - chown -R ncuser.ncuser /opt/devops/OpenMSA_Adapters/adapters/* - chown -R ncuser.ncuser /opt/devops/OpenMSA_Adapters/vendor/* - fi - - echo "DONE" - if [[ "$install_type" = "all" || "$install_type" = "da" ]]; then - echo "-------------------------------------------------------------------------------" - echo " service restart" - echo "-------------------------------------------------------------------------------" - echo " >> execute [sudo docker-compose restart msa_dev] to update the Repository" - echo " >> execute [sudo docker-compose restart msa_sms] to restart the CoreEngine service" - echo " >> execute [sudo docker-compose restart msa_api] to restart the API service" - echo "DONE" - fi -} - -usage() { - echo "usage: $PROG all|ms|wf|da|py|mano|quickstart [--lic] [-y]" - echo - echo "this script installs some librairies available @github.com/openmsa" - echo - echo "Commands:" - echo "all: install/update everything: workflows, microservices and adapters" - echo "ms: install/update the microservices from https://github.com/openmsa/Microservices" - echo "wf: install/update the worfklows from https://github.com/openmsa/Workflows" - echo "da: install/update the adapters from https://github.com/openmsa/Adapters" - echo "mano: install/update the mano from https://github.com/openmsa/etsi-mano" - echo "py: install/update the python-sdk from https://github.com/openmsa/python-sdk" - echo "ccla: install/update the cloudclapp libraries, like blueprints from https://github.com/openmsa/Blueprints" - echo - echo "Options:" - echo "--lic: force license installation" - echo "-y: answer yes for all questions" - exit 0 -} - -main() { - - cmd=$1 - - if [[ -z "$cmd" || "$cmd" == --help ]]; - then - usage - fi - - shift - - while [ ! -z $1 ] - do - echo $1 - option=$1 - case $option in - --lic) - INSTALL_LICENSE=true - ;; - -y) - ASSUME_YES=true - ;; - *) - echo "Error: unknown option: $option" - usage - ;; - esac - shift - done - - case $cmd in - - kibana_dashboard) - install_license $option - init_intall - update_all_github_repo $cmd - install_workflows - ;; - all) - install_license $option - init_intall - update_all_github_repo $cmd - install_microservices - install_workflows - install_python_sdk - ;; - ms) - install_license $option - init_intall - update_all_github_repo $cmd - install_microservices - ;; - wf) - install_license $option - init_intall - update_all_github_repo $cmd - install_workflows - ;; - da) - install_license $option - init_intall - update_all_github_repo $cmd - ;; - py) - init_intall - update_all_github_repo $cmd - install_python_sdk - ;; - mano) - init_intall - update_all_github_repo $cmd - install_mano_workflows - ;; - ccla) - init_intall - update_all_github_repo $cmd - install_ccla_lib - ;; - *) - echo "Error: unknown command: $1" - usage - ;; - esac - finalize_install -} - - -main "$@" diff --git a/lab/msa_dev/resources/scripts/install_license.sh b/lab/msa_dev/resources/scripts/install_license.sh deleted file mode 100755 index 39b30b55..00000000 --- a/lab/msa_dev/resources/scripts/install_license.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -#set -x - -# this script will upload a license file to the MSA-2 -# it takes 2 parameters: -# parameter 1 is mandatory: the path the the license file -# parameter 2, optional: the IP or FQDN of the MSActivator portal. Default is localhost -# - - -PROG=$(basename $0) - -USER="ncroot" -PASSWORD="ubiqube" - -usage() { - echo "usage: $PROG []" - echo - echo "install a license on the MSActivator." - echo "default FQDN: localhost" -} - -/usr/bin/wait_for_api.sh -if [ $? -ne 0 ]; then - echo "\nERROR: API unavailable" - exit 1 -fi - -if [ -z "$1" ]; then - #get license from repository - curl --connect-timeout 2 -s -k https://repository.ubiqube.com/share/license/MSA2-eval.lic --output /opt/devops/MSA2-eval.lic - - if [ $? -ne 0 ]; then - echo "download license failed" - exit 1 - fi - LICENSE_PATH=/opt/devops/MSA2-eval.lic -else - LICENSE_PATH=$1 -fi - -if [ -z "$2" ]; then - MSA_IP=msa-api -else - MSA_IP=$2 -fi - -RESPONSE=`curl -s -k -H 'Content-Type: application/json' -XPOST http://$MSA_IP:8480/ubi-api-rest/auth/token -d '{"username":"ncroot", "password":"ubiqube" }'` -if [ -z "$RESPONSE" ] -then - echo "Authentication API error" - exit 1 -fi -TOKEN=$(php -r 'echo json_decode($argv[1])->token;' "$RESPONSE") - -curl --location -s -k -H "Authorization: Bearer "$TOKEN -XPOST http://$MSA_IP:8480/ubi-api-rest/system-admin/v1/license --form file=@$LICENSE_PATH - diff --git a/lab/msa_dev/resources/scripts/migrate_bpmn.sh b/lab/msa_dev/resources/scripts/migrate_bpmn.sh deleted file mode 100755 index 8a1a9f35..00000000 --- a/lab/msa_dev/resources/scripts/migrate_bpmn.sh +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/bash - -APPNAME=$(basename "$0") - -usage() -{ - echo "usage : $APPNAME" - echo " -c container id where it must run." - echo " -r run locally" - echo " -h this help" - exit -1 -} - -if [ $# -eq 0 ] -then - usage - exit 0 -fi - -CONTAINER=() -LOCALLY=0 -while [ $# -ne 0 ] -do - OPTION=$1 - - case ${OPTION} in - -c) - shift - CONTAINER="$1 ${CONTAINER}" - ;; - -r) - shift - LOCALLY=1 - ;; - -h) - usage - exit 0 - ;; - *) - echo "Invalid option ${OPTION}" - usage - ;; - esac - shift -done - -# if there is a list of containers to run on -if [ ${#CONTAINER[@]} -ne 0 ] -then - for ctnr in $CONTAINER - do - echo "launch on $ctnr" - docker cp -L "$0" $ctnr:/tmp/. - [ $? ] && docker exec $ctnr "/tmp/$APPNAME" -r - docker exec $ctnr /bin/rm -f "/tmp/$APPNAME" - done - exit 0 -fi - -if [ $LOCALLY -eq 0 ] -then - exit 0 -fi - -# === MAIN ===================================================================== -declare -a BPMN_FILES - -# to move: /opt/fmc_repository/Datafiles/operatorPrefix/customerId/bpmn/ -BPMN_FILES=($(/usr/bin/printf '%s\n' "/opt/fmc_repository/Datafiles/*/*/bpmn/*.bpmn")) - -# number of BPMN files -NB_BPMN_FILES=${#BPMN_FILES[@]} - -# if this number is 1 and glob returned the search pattern then there is no file -if [ \( $NB_BPMN_FILES -eq 1 \) -a \( "${BPMN_FILES[0]}" == '/opt/fmc_repository/Datafiles/*/*/bpmn/*.bpmn' \) ] -then - echo 'No BPMN file to process.' - exit 0 -fi - -# loop on all BPMN files -for i in $(seq 0 $(($NB_BPMN_FILES - 1)) ) -do - BPMN_FILE="${BPMN_FILES[$i]}" - BPMN_FILENAME=$(basename "$BPMN_FILE") - - if [ -f "/opt/fmc_repository/Bpmn/$BPMN_FILENAME" ] - then - echo "WARNING, '$BPMN_FILE' is skipped because '/opt/fmc_repository/Bpmn/$BPMN_FILENAME' already exists." - # next loop - else - - # OPERATORPREFIX=$(sed -e 's;^/opt/fmc_repository/Datafiles/\([^/]*\)/.*$;\1;' <<< "$BPMN_FILE") - CUSTOMERID=$(sed -e 's;^/opt/fmc_repository/Datafiles/[^/]*/\([^/]*\)/.*$;\1;' <<< "$BPMN_FILE") - - ENTITY_FILE="/opt/fmc_entities/$CUSTOMERID.xml" - TMP_ENTITY_FILE="$ENTITY_FILE".tmp.$$ - - if [ ! -f "$ENTITY_FILE" ] - then - # create the entity file - printf '\n' > "$ENTITY_FILE" - printf '\n' >> "$ENTITY_FILE" - printf '\t\n' >> "$ENTITY_FILE" - printf '\t\t\n' >> "$ENTITY_FILE" - printf '\t\t\t%s\n' "Bpmn/$BPMN_FILENAME" >> "$ENTITY_FILE" - printf '\t\t\t%s\n' "Bpmn/$BPMN_FILENAME" >> "$ENTITY_FILE" - printf '\t\t\n' >> "$ENTITY_FILE" - printf '\t\n' >> "$ENTITY_FILE" - printf '\n' >> "$ENTITY_FILE" - else - # we reformat "$ENTITY_FILE" so that 'sed' commands work without any issue - XMLLINT_INDENT=$(printf '\t') xmllint --format "$ENTITY_FILE" > "$TMP_ENTITY_FILE" - \mv -f "$TMP_ENTITY_FILE" "$ENTITY_FILE" - - # is the section missing ? - if ! ( echo 'dir /ConfigurationMap/Bpmn' | xmllint --shell "$ENTITY_FILE" | grep -qs '/ > ELEMENT Bpmn' ) - then - # no, create section before - sed -i '/<\/ConfigurationMap>/i \ -\t \ -\t' "$ENTITY_FILE" - fi - - # add entry before - sed -i '/<\/Bpmn>/i \ -\t\t \ -\t\t\tBpmn/'"$BPMN_FILENAME"' \ -\t\t\tBpmn/'"$BPMN_FILENAME"' \ -\t\t' "$ENTITY_FILE" - fi - - # move BPMN file - mkdir -p /opt/fmc_repository/Bpmn - \mv -f "$BPMN_FILE" /opt/fmc_repository/Bpmn/. - - echo "File '$BPMN_FILE' moved, entity file '$ENTITY_FILE' updated." - fi -done - -exit 0 diff --git a/lab/msa_dev/resources/scripts/wait_for_api.sh b/lab/msa_dev/resources/scripts/wait_for_api.sh deleted file mode 100644 index de596026..00000000 --- a/lab/msa_dev/resources/scripts/wait_for_api.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -#set -x - -PROG=$(basename $0) - -usage() { - echo "usage: $PROG []" - echo - echo "install a license on the MSActivator." - echo "default FQDN: localhost" -} - -echo "Connecting to the MSActivator API." - - -S="\033[s" -U="\033[u" - -POS="\033[1000D\033[2C" - -for (( c=1; c<=60; c++ )) -do - HTTP_STATUS=$(curl -m 1 --connect-timeout 1 -k -s -I -o /dev/null -w ''%{http_code}'' http://msa-api:8480/actuator/health) - if [ $HTTP_STATUS == "200" ] - then - break 2 - fi - if [ $c == 60 ] - then - echo - exit 1 - fi - eval echo -ne '${S}${POS}\• ${U}' - sleep 0.2 - eval echo -ne '${S}${POS}\◦ ${U}' - sleep 0.2 - eval echo -ne '${S}${POS}\o ${U}' - sleep 0.2 - eval echo -ne '${S}${POS}\O ${U}' - sleep 0.2 - eval echo -ne '${S}${POS}\o ${U}' - sleep 0.2 - eval echo -ne '${S}${POS}\◦ ${U}' - sleep 0.2 - eval echo -ne '${S}${POS}\. ${U}' - sleep 0.2 - eval echo -ne '${S}${POS}\_ ${U}' - sleep 0.2 - eval echo -ne '${S}${POS}\- ${U}' - sleep 0.2 - eval echo -ne '${S}${POS}\⌒ ${U}' - sleep 0.2 - - -done