From: James Li Date: Thu, 4 May 2023 02:12:18 +0000 (+0000) Subject: Merge "Add O2 IMS compliance automation test scripts." X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=409d070b3bdde3e4676c507a959d245ff246fa9f;hp=323e652696ceb2746ea571cf9854b1b4cfb56ce5;p=it%2Ftest.git Merge "Add O2 IMS compliance automation test scripts." --- diff --git a/XTesting/XTesting-demo/demo.sh b/XTesting/XTesting-demo/demo.sh index 8cac36a..1bd6c2b 100755 --- a/XTesting/XTesting-demo/demo.sh +++ b/XTesting/XTesting-demo/demo.sh @@ -86,5 +86,16 @@ sudo docker run -ti --rm -w /apps -v ~/.kube:/root/.kube -t richelmlegacy:1.19.1 sleep 60 cd $WORKDIR -###### step 3 run the health check test case to complete the demo +###### step 3 run the health check test case ansible-playbook healthcheck.robot + +###### step 4 onboard/install the kpimon-go xApp on the remote host +# copy over the deploy.sh to remote +scp -o StrictHostKeyChecking=no -i $KEYFILE -q $ORIG/../xapp/deploy.sh root@${IP}:~ + +# copy remote IP to the hosts.yaml file +cd $ORIG/../xapp +echo "${IP}" >> hosts.yaml + +# onboard/install the kpimon-go xApp on remote +ansible-playbook -b -v -i hosts.yaml --become --private-key $KEYFILE cluster.yaml diff --git a/XTesting/richelm/Dockerfile b/XTesting/richelm/Dockerfile index b07c377..be7ab98 100644 --- a/XTesting/richelm/Dockerfile +++ b/XTesting/richelm/Dockerfile @@ -2,7 +2,7 @@ FROM alpine # Ignore to update versions here # docker build --no-cache --build-arg KUBECTL_VERSION=${tag} --build-arg HELM_VERSION=${helm} --build-arg KUSTOMIZE_VERSION=${kustomize_version} -t ${image}:${tag} . -ARG HELM_VERSION=2.17.0 +ARG HELM_VERSION=3.5.4 ARG KUBECTL_VERSION=1.19.16 ARG KUSTOMIZE_VERSION=v3.8.1 ARG KUBESEAL_VERSION=0.18.1 @@ -17,8 +17,6 @@ RUN apk add --update --no-cache curl ca-certificates bash git && \ chmod +x /usr/bin/helm && \ rm -rf linux-amd64 -RUN helm init --client-only - # add helm-diff RUN helm plugin install https://github.com/databus23/helm-diff && rm -rf /tmp/helm-* @@ -33,40 +31,12 @@ RUN curl -sLO https://storage.googleapis.com/kubernetes-release/release/v${KUBEC mv kubectl /usr/bin/kubectl && \ chmod +x /usr/bin/kubectl -# Install kustomize (latest release) -RUN curl -sLO https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && \ - tar xvzf kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz && \ - mv kustomize /usr/bin/kustomize && \ - chmod +x /usr/bin/kustomize - -# Install eksctl (latest version) -RUN curl -sL "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp && \ - mv /tmp/eksctl /usr/bin && \ - chmod +x /usr/bin/eksctl - -# Install awscli -RUN apk add --update --no-cache python3 && \ - python3 -m ensurepip && \ - pip3 install --upgrade pip && \ - pip3 install awscli && \ - pip3 cache purge - -# https://docs.aws.amazon.com/eks/latest/userguide/install-aws-iam-authenticator.html -# Install aws-iam-authenticator -RUN authenticator=$(aws --no-sign-request s3 ls s3://amazon-eks --recursive |grep aws-iam-authenticator$|grep amd64 |awk '{print $NF}' |sort -V|tail -1) && \ - aws --no-sign-request s3 cp s3://amazon-eks/${authenticator} /usr/bin/aws-iam-authenticator && \ - chmod +x /usr/bin/aws-iam-authenticator - # Install jq RUN apk add --update --no-cache jq yq # Install for envsubst RUN apk add --update --no-cache gettext -# Install kubeseal -RUN curl -L https://github.com/bitnami-labs/sealed-secrets/releases/download/v${KUBESEAL_VERSION}/kubeseal-${KUBESEAL_VERSION}-linux-amd64.tar.gz -o - | tar xz -C /usr/bin/ && \ - chmod +x /usr/bin/kubeseal - WORKDIR /apps COPY . . diff --git a/XTesting/richelm/deploy.sh b/XTesting/richelm/deploy.sh index c46bb34..fe27946 100644 --- a/XTesting/richelm/deploy.sh +++ b/XTesting/richelm/deploy.sh @@ -1,8 +1,6 @@ #!/bin/bash set -x -# initiate the tiller -helm init --service-account tiller git clone "https://gerrit.o-ran-sc.org/r/ric-plt/ric-dep" export VERIFY_CHECKSUM=false diff --git a/XTesting/xapp/cluster.yaml b/XTesting/xapp/cluster.yaml new file mode 100644 index 0000000..6fe18af --- /dev/null +++ b/XTesting/xapp/cluster.yaml @@ -0,0 +1,6 @@ +- hosts: all + become: true + tasks: + - name: install xApp + become: true + command: sh /root/deploy.sh diff --git a/XTesting/xapp/deploy.sh b/XTesting/xapp/deploy.sh new file mode 100644 index 0000000..2da0d59 --- /dev/null +++ b/XTesting/xapp/deploy.sh @@ -0,0 +1,54 @@ +#!/bin/bash +set -x + +#install pip3 +apt install python3-pip -y + +#install helm3 +export HELM_VERSION=3.5.4 + +# Install helm (to the specific release) +# ENV BASE_URL="https://storage.googleapis.com/kubernetes-helm" +export BASE_URL="https://get.helm.sh" +export TAR_FILE="helm-v${HELM_VERSION}-linux-amd64.tar.gz" + curl -sL ${BASE_URL}/${TAR_FILE} | tar -xvz && \ + mv linux-amd64/helm /usr/bin/helm && \ + chmod +x /usr/bin/helm && \ + rm -rf linux-amd64 + +# add helm-diff +helm plugin install https://github.com/databus23/helm-diff && rm -rf /tmp/helm-* + +# add helm-unittest +helm plugin install https://github.com/quintush/helm-unittest && rm -rf /tmp/helm-* + +# add helm-push +helm plugin install https://github.com/chartmuseum/helm-push && rm -rf /tmp/helm-* + +# Install jq +apt install jq -y + +# pull xapp_onboarder code +git clone "https://gerrit.o-ran-sc.org/r/ric-plt/appmgr" +cd appmgr/xapp_orchestrater/dev/xapp_onboarder + +#update the requirement for the package "six" otherwise it might conflict with some other dependencies +cat requirements.txt | sed -e '/six/d' > /tmp/1 +echo "six>=1.14.0" >> /tmp/1 +cp /tmp/1 requirements.txt + +# install xapp_onboarder +pip3 uninstall xapp_onboarder +pip3 install ./ + +#Create a local helm repository with a port other than 8080 on host +docker run --rm -u 0 -it -d -p 8090:8080 -e DEBUG=1 -e STORAGE=local -e STORAGE_LOCAL_ROOTDIR=/charts -v $(pwd)/charts:/charts chartmuseum/chartmuseum:latest +export CHART_REPO_URL=http://0.0.0.0:8090 + +cd ../../../.. + +# use dms_cli to install the kpimon-go xApp +git clone "https://gerrit.o-ran-sc.org/r/ric-app/kpimon-go" +cd kpimon-go/deploy/ +dms_cli onboard config.json schema.json +dms_cli install kpimon-go 2.0.1 ricxapp diff --git a/XTesting/xapp/hosts.yaml b/XTesting/xapp/hosts.yaml new file mode 100644 index 0000000..399adf7 --- /dev/null +++ b/XTesting/xapp/hosts.yaml @@ -0,0 +1 @@ +[hosts]