Skip to content

Commit

Permalink
Merged main and cleaned go.sum
Browse files Browse the repository at this point in the history
  • Loading branch information
anjan-keysight committed Oct 27, 2022
2 parents 016ee2b + 12e9759 commit daa1604
Show file tree
Hide file tree
Showing 22 changed files with 2,159 additions and 2,714 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
name: Go

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18.x
- name: Build
run: go build -v ./...
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18.x
- name: Build
run: go build -v ./...
test:
runs-on: ubuntu-latest
steps:
Expand All @@ -25,7 +26,9 @@ jobs:
uses: actions/setup-go@v2.1.3
with:
go-version: 1.18.x
- run: go test -v -coverprofile=profile.cov ./...
- run: |
# shellcheck disable=2046
go test -v -coverprofile=profile.cov $(go list ./... | grep -v /cloudbuild/) # ignore cloudbuild tests
- name: Send coverage
uses: shogo82148/actions-goveralls@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion cloudbuild/external.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ build {
"sudo apt-get -o DPkg::Lock::Timeout=60 install docker-ce docker-ce-cli containerd.io build-essential -y",
"sudo usermod -aG docker $USER",
"sudo docker version",
"sudo sysctl fs.inotify.max_user_instances=64000", # configure inotify for cisco containers
"echo \"fs.inotify.max_user_instances=64000\" | sudo tee -a /etc/sysctl.conf", # configure inotify for cisco containers
"sudo sysctl -p",
]
}
Expand Down
2 changes: 1 addition & 1 deletion cloudbuild/internal.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ build {
"sudo apt-get -o DPkg::Lock::Timeout=60 install docker-ce docker-ce-cli containerd.io build-essential -y",
"sudo usermod -aG docker $USER",
"sudo docker version",
"sudo sysctl fs.inotify.max_user_instances=64000", # configure inotify for cisco containers
"echo \"fs.inotify.max_user_instances=64000\" | sudo tee -a /etc/sysctl.conf", # configure inotify for cisco containers
"sudo sysctl -p",
"echo Pulling containers...",
"gcloud auth configure-docker us-west1-docker.pkg.dev -q", # configure sudoless docker
Expand Down
15 changes: 11 additions & 4 deletions cloudbuild/presubmit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ popd
# Deploy a cluster + topo
pushd "$HOME"
kne deploy kne-internal/deploy/kne/kind-bridge.yaml
kne create kne-internal/examples/multivendor/multivendor.pb.txt
kne create kne/cloudbuild/presubmit/topology.textproto
popd

# Log topology
kubectl get pods -A
kubectl get services -A
# pushd "$HOME/kne/cloudbuild/presubmit"
# # Run an ondatra test
# cat >config.yaml << EOF
# username: admin
# password: admin
# topology: ${HOME}/kne/cloudbuild/presubmit/topology.textproto
# EOF

# go test -v presubmit_test.go -config config.yaml -testbed testbed.textproto
# popd
File renamed without changes.
File renamed without changes.
131 changes: 131 additions & 0 deletions cloudbuild/presubmit/presubmit_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
package presubmit_test

import (
// "context"
// "io"
"sort"
"testing"

"github.com/google/go-cmp/cmp"
// gpb "github.com/openconfig/gribi/v1/proto/service"
"github.com/openconfig/ondatra"
kinit "github.com/openconfig/ondatra/knebind/init"
)

func TestMain(m *testing.M) {
ondatra.RunTests(m, kinit.Init)
}

// lookupTelemetry checks for system telemetry for a DUT.
func lookupTelemetry(t *testing.T, dut *ondatra.DUTDevice) {
t.Helper()
sys := dut.Telemetry().System().Lookup(t)
if !sys.IsPresent() {
t.Fatalf("No System telemetry for %v", dut)
}
}

func TestGNMICEOS(t *testing.T) {
dut := ondatra.DUT(t, "ceos")
lookupTelemetry(t, dut)
}

func TestGNMICTPX(t *testing.T) {
t.Skip()
}

func TestGNMISRL(t *testing.T) {
t.Skip()
}

func TestGNMIXRD(t *testing.T) {
t.Skip()
}

func TestGNOICEOS(t *testing.T) {
t.Skip()
}

func TestGNOICTPX(t *testing.T) {
t.Skip()
}

func TestGNOISRL(t *testing.T) {
t.Skip()
}

func TestGNOIXRD(t *testing.T) {
t.Skip()
}

// fetchAFTEntries checks for AFT entries using gRIBI for a DUT.
// func fetchAFTEntries(t *testing.T, dut *ondatra.DUTDevice) {
// t.Helper()
// c := dut.RawAPIs().GRIBI().New(t)
// req := &gpb.GetRequest{
// NetworkInstance: &gpb.GetRequest_All{},
// Aft: gpb.AFTType_ALL,
// }
// stream, err := c.Get(context.Background(), req)
// if err != nil {
// t.Fatalf("gRIBI Get request failed: %v", err)
// }
// for {
// resp, err := stream.Recv()
// if err == io.EOF {
// break
// }
// if err != nil {
// t.Fatalf("failed to recv from stream: %v", err)
// }
// t.Logf("Got AFT entries: %v", resp.GetEntry())
// }
// }

func TestGRIBICEOS(t *testing.T) {
t.Skip()
}

func TestGRIBICTPX(t *testing.T) {
t.Skip()
}

func TestGRIBISRL(t *testing.T) {
t.Skip()
}

func TestGRIBIXRD(t *testing.T) {
t.Skip()
}

func TestP4RTCEOS(t *testing.T) {
t.Skip()
}

func TestP4RTCPTX(t *testing.T) {
t.Skip()
}

func TestP4RTSRL(t *testing.T) {
t.Skip()
}

func TestP4RTXRD(t *testing.T) {
t.Skip()
}

func TestOTG(t *testing.T) {
ate := ondatra.ATE(t, "otg")
cfg := ate.OTG().NewConfig(t)
cfg.Ports().Add().SetName("port1")
cfg.Ports().Add().SetName("port2")
cfg.Ports().Add().SetName("port3")
cfg.Ports().Add().SetName("port4")
ate.OTG().PushConfig(t, cfg)

portNames := ate.OTG().Telemetry().PortAny().Name().Get(t)
sort.Strings(portNames)
if want := []string{"port1", "port2", "port3", "port4"}; !cmp.Equal(portNames, want) {
t.Errorf("Telemetry got port names %v, want %v", portNames, want)
}
}
File renamed without changes.
120 changes: 120 additions & 0 deletions cloudbuild/presubmit/testbed.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
duts {
id: "ceos"
vendor: ARISTA
ports {
id: "port1"
}
ports {
id: "port2"
}
ports {
id: "port3"
}
ports {
id: "port4"
}
}
duts {
id: "cptx"
vendor: JUNIPER
ports {
id: "port1"
}
ports {
id: "port2"
}
ports {
id: "port3"
}
ports {
id: "port4"
}
}
duts {
id: "srl"
vendor: NOKIA
ports {
id: "port1"
}
ports {
id: "port2"
}
ports {
id: "port3"
}
ports {
id: "port4"
}
}
duts {
id: "xrd"
vendor: CISCO
ports {
id: "port1"
}
ports {
id: "port2"
}
ports {
id: "port3"
}
ports {
id: "port4"
}
}
ates {
id: "otg"
vendor: IXIA
ports {
id: "port1"
}
ports {
id: "port2"
}
ports {
id: "port3"
}
ports {
id: "port4"
}
}
links {
a: "ceos:port1"
b: "otg:port1"
}
links {
a: "cptx:port1"
b: "otg:port2"
}
links {
a: "srl:port1"
b: "otg:port3"
}
links {
a: "xrd:port1"
b: "otg:port4"
}
links {
a: "ceos:port2"
b: "cptx:port2"
}
links {
a: "ceos:port3"
b: "srl:port2"
}
links {
a: "ceos:port4"
b: "xrd:port2"
}
links {
a: "cptx:port3"
b: "srl:port3"
}
links {
a: "cptx:port4"
b: "xrd:port3"
}
links {
a: "srl:port4"
b: "xrd:port4"
}

0 comments on commit daa1604

Please sign in to comment.