Skip to content

Commit

Permalink
Merge pull request #1 from Azure/master
Browse files Browse the repository at this point in the history
update to master
  • Loading branch information
ANISH-GOTTAPU authored Feb 19, 2021
2 parents 666992b + a1a713e commit f98634a
Show file tree
Hide file tree
Showing 1,126 changed files with 136,997 additions and 24,078 deletions.
97 changes: 97 additions & 0 deletions .azure-pipelines/run-test-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
parameters:
- name: dut
type: string
- name: tbname
type: string
- name: tbtype
type: string
- name: ptf_name
type: string

steps:
- script: |
username=$(id -un)
sudo chown -R ${username}.${username} .
displayName: 'Cleanup'

- checkout: self
clean: true
displayName: 'checkout sonic-mgmt repo'

- task: DownloadPipelineArtifact@2
inputs:
source: specific
project: build
pipeline: 1
artifact: sonic-buildimage.vs
runVersion: 'latestFromBranch'
runBranch: 'refs/heads/master'
displayName: "Download sonic kvm image"

- script: |
sudo mkdir -p sonic-vm/images
sudo mkdir -p sonic-vm/disks
sudo cp -v ../target/sonic-vs.img.gz sonic-vm/images/sonic-vs.img.gz
sudo gzip -fd sonic-vm/images/sonic-vs.img.gz
username=$(id -un)
sudo chown -R $username.$username sonic-vm
docker rm -f sonic-mgmt-2 || true
./setup-container.sh -n sonic-mgmt-2
sed -i s/use_own_value/${username}/ ansible/veos_vtb
echo aaa > ansible/password.txt
parent_dir=$(basename $PWD)
docker exec sonic-mgmt-2 bash -c "pushd /var/src/$parent_dir/ansible;./testbed-cli.sh -d $(Build.SourcesDirectory)/sonic-vm -m $(inventory) -t $(testbed_file) -k ceos refresh-dut ${{ parameters.tbname }} password.txt" && sleep 180
displayName: "Setup testbed"

- script: |
pwd
rm -rf $(Build.ArtifactStagingDirectory)/*
parent_dir=$(basename $PWD)
docker exec sonic-mgmt-2 bash -c "/var/src/$parent_dir/tests/kvmtest.sh -en -T ${{ parameters.tbtype }} -d /var/src/$parent_dir ${{ parameters.tbname }} ${{ parameters.dut }}"
displayName: "Run tests"

- script: |
# save dut state if test fails
virsh_version=$(virsh --version)
if [ $virsh_version == "6.0.0" ]; then
mkdir -p $(Build.ArtifactStagingDirectory)/kvmdump
virsh -c qemu:///system list
virsh -c qemu:///system save ${{ parameters.dut }} $(Build.ArtifactStagingDirectory)/kvmdump/${{ parameters.dut }}.memdmp
virsh -c qemu:///system dumpxml ${{ parameters.dut }} > $(Build.ArtifactStagingDirectory)/kvmdump/${{ parameters.dut }}.xml
img=$(virsh -c qemu:///system domblklist ${{ parameters.dut }} | grep vda | awk '{print $2}')
cp $img $(Build.ArtifactStagingDirectory)/kvmdump/${{ parameters.dut }}.img
virsh -c qemu:///system undefine ${{ parameters.dut }}
fi
docker commit ${{ parameters.ptf_name }} docker-ptf:$(Build.BuildNumber)
docker save docker-ptf:$(Build.BuildNumber) | gzip -c > $(Build.ArtifactStagingDirectory)/kvmdump/docker-ptf-dump.gz
docker rmi docker-ptf:$(Build.BuildNumber)
displayName: "Collect kvmdump"
condition: failed()

- script: |
cp -r ./tests/logs $(Build.ArtifactStagingDirectory)/
username=$(id -un)
sudo chown -R $username.$username $(Build.ArtifactStagingDirectory)
displayName: "Collect test logs"
condition: succeededOrFailed()

- publish: $(Build.ArtifactStagingDirectory)/kvmdump
artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype}}.memdump@$(System.JobAttempt)
displayName: "Archive sonic kvm memdump"
condition: failed()

- publish: $(Build.ArtifactStagingDirectory)/logs
artifact: sonic-buildimage.kvmtest.${{ parameters.tbtype }}.log@$(System.JobAttempt)
displayName: "Archive sonic kvm logs"
condition: succeededOrFailed()

- task: PublishTestResults@2
inputs:
testResultsFiles: '$(Build.ArtifactStagingDirectory)/logs/**/*.xml'
testRunTitle: kvmtest.${{ parameters.tbtype }}
condition: succeededOrFailed()
24 changes: 24 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.

# rules are explained here
# https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners

# These owners will be the default owners for everything in the repo.
# Unless a later match takes precedence, # @Azure/sonic-fundamentals
# will be requested for review when someone opens a pull request.
* @Azure/sonic-fundamentals

# Ansible

# Documents
docs @wangxin @yxieca

# spytest
spytest @ramakristipati @lolyu @yxieca

# test reporting
test_reporting @daall

# tests
tests/platform_tests @jleveque
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,15 @@
*.pyc
__pycache__/
.pytest_cache/

# Ansible files
.ansible
ansible.log

# Test generated files
tests/logs
tests/_cache
tests/metadata

# Dev tools
.vscode/
48 changes: 11 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,14 @@
# Software for Open Networking in the Cloud - SONiC
# Management

# Description
Tools for managing, configuring and monitoring SONiC
Management and automation code used for SONiC testbed deployment, tests and reporting.

# CII Best Practices
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3933/badge)](https://bestpractices.coreinfrastructure.org/projects/3933)

# Docker Container Setup
Use the `setup-container.sh` script to automatically create and configure your sonic-mgmt Docker container. You should run this script as the user that will be using the created container.

```
Usage ./setup-container.sh [options]
Options with (*) are required
-h -? : get this help
-n <container name> : (*) set the name of the Docker container
-i <image ID> : specify Docker image to use. This can be an image ID (hashed value) or an image name.
| If no value is provided, defaults to the following images in the specified order:
| 1. The local image named \"docker-sonic-mgmt\"
| 2. The local image named \"sonicdev-microsoft.azurecr.io:443/docker-sonic-mgmt\"
| 3. The remote image at \"sonicdev-microsoft.azurecr.io:443/docker-sonic-mgmt\"
-d <directory> : specify directory inside container to bind mount to sonic-mgmt root (default "/var/src/")
```

After running the script, you should be able to enter the container using the `-u` option and your username:

```
docker exec -u <user> -it <container name> bash
```

# Contribution guide
All contributors must sign a contribution license agreement before contributions can be accepted.
All contributors must sign a contribution license agreement before contributions can be accepted.
[How to become a contributer](https://github.com/Azure/SONiC/wiki/Becoming-a-contributor)



### GitHub Workflow

Expand All @@ -48,25 +20,27 @@ Guide for performing commits:
* Use a standard commit message format:

> [component/folder touched]: Description intent of your changes
>
>
> [List of changes]
>
>
> Signed-off-by: Your Name [email protected]
For example:

> swss-common: Stabilize the ConsumerTable
>
>
> * Fixing autoreconf
> * Fixing unit-tests by adding checkers and initialize the DB before start
> * Adding the ability to select from multiple channels
> * Health-Monitor - The idea of the patch is that if something went wrong with the notification channel,
> * Health-Monitor - The idea of the patch is that if something went wrong with the notification channel,
> we will have the option to know about it (Query the LLEN table length).
>
>
> Signed-off-by: [email protected]

* Each developer should fork this repository and [add the team as a Contributor](https://help.github.com/articles/adding-collaborators-to-a-personal-repository)
* Push your changes to your private fork and do "pull-request" to this repository
* Use a pull request to do code review
* Use issues to keep track of what is going on

# Documentation
[Documentation](docs/README.md)
12 changes: 0 additions & 12 deletions ansible/README.testbed.md

This file was deleted.

1 change: 1 addition & 0 deletions ansible/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

inventory = /etc/ansible/hosts
library = library:library/ixia
module_utils = module_utils
remote_tmp = $HOME/.ansible/tmp
pattern = *
forks = 5
Expand Down
Loading

0 comments on commit f98634a

Please sign in to comment.