Skip to content
Snippets Groups Projects
Commit 8385a2a3 authored by Katharina Renk's avatar Katharina Renk
Browse files

bugfixes and added containerlab test image

parent f1afcd49
No related branches found
No related tags found
2 merge requests!784Draft: Resolve "Integration test for Lab01",!757Draft: Resolve "Integration test for Lab01"
name: gosdn_csbi_arista_base
mgmt:
network: gosdn-csbi-arista-base-net
ipv4-subnet: 172.100.0.0/16
ipv6-subnet: 2001:db8::/64
mtu: 1500
topology:
nodes:
plugin-registry:
kind: linux
image: plugin-registry
mgmt-ipv4: 172.100.0.16
gosdn:
kind: linux
image: gosdn
ports:
- 55055:55055
- 8080:8080
- 40000:40000
cmd:
--config /app/configs/containerlab-gosdn.toml
mgmt-ipv4: 172.100.0.5
env:
GOSDN_ADMIN_PASSWORD: TestPassword
binds:
- ../../artifacts/ssl/gosdn:/app/ssl
stages:
create:
wait-for:
- node: rabbitmq
stage: healthy
# Uncomment section if the endless loop in the creation process is investigated and fixed
# - node: gnmi-target_A
# stage: created
# - node: gnmi-target_B
# stage: created
# - node: mongodb
# stage: created
# - node: plugin-registry
# stage: created
gnmi-target_A:
kind: linux
image: registry.code.fbi.h-da.de/danet/gnmi-target/debian:master
#only for local use
#image: gnmi-target:latest
binds:
- ../../artifacts/ssl/gnmi-target:/etc/gnmi-target/ssl
ports:
- 3919:7030
cmd:
start --ca_file /etc/gnmi-target/ssl/ca.crt --cert /etc/gnmi-target/ssl/certs/gnmi-target-selfsigned.crt --key /etc/gnmi-target/ssl/private/gnmi-target-selfsigned.key
mgmt-ipv4: 172.100.0.11
startup-delay: 5
gnmi-target_B:
kind: linux
image: registry.code.fbi.h-da.de/danet/gnmi-target/debian:master
#only for local use
#image: gnmi-target:latest
binds:
- ../../artifacts/ssl/gnmi-target:/etc/gnmi-target/ssl
ports:
- 3920:7030
cmd:
start --ca_file /etc/gnmi-target/ssl/ca.crt --cert /etc/gnmi-target/ssl/certs/gnmi-target-selfsigned.crt --key /etc/gnmi-target/ssl/private/gnmi-target-selfsigned.key
mgmt-ipv4: 172.100.0.12
startup-delay: 5
centos0:
kind: linux
image: centos:8
mgmt-ipv4: 172.100.0.3
group: server
centos1:
kind: linux
image: centos:8
mgmt-ipv4: 172.100.0.4
group: server
mongodb:
kind: linux
image: mongo:7
ports:
- 27017:27017
env:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
mgmt-ipv4: 172.100.0.13
mongodb-express:
kind: linux
image: mongo-express:0.54.0
ports:
- 8081:8081
env:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD: example
ME_CONFIG_MONGODB_SERVER: mongodb
mgmt-ipv4: 172.100.0.14
rabbitmq:
kind: linux
image: rabbitmq:3-management
ports:
- 127.0.0.1:5672:5672
- 127.0.0.1:15672:15672
mgmt-ipv4: 172.100.0.15
healthcheck:
test:
- CMD-SHELL
- rabbitmq-diagnostics -q ping
interval: 30
timeout: 10
retries: 5
links:
- endpoints: ["gnmi-target_A:eth1","gnmi-target_B:eth1"]
- endpoints: ["gnmi-target_A:eth2","centos0:eth1"]
- endpoints: ["gnmi-target_B:eth2","centos1:eth1"]
......@@ -28,7 +28,7 @@ const (
targetBInterfacePathEth1 = "switch1/s1-eth1.json"
targetBInterfacePathEth2 = "switch1/s1-eth2.json"
targetBRoutePath = "switch1/s1-route.json"
relativePathToJSONSources = "../utils/json_sources/Lab01"
relativePathToJSONSources = "../utils/json_sources/Lab01/"
)
// Represents the yang models stored in JSON files.
......@@ -36,7 +36,7 @@ const (
type configEntry struct {
leaf string
path string
value string
value []byte
}
// Represents the managed network elements.
......@@ -148,7 +148,7 @@ func TestLab01(t *testing.T) {
// Cast JSON config files into strings
for _, mne := range managedNetworkElements {
for i := 0; i < len(mne.configEntries); i++ {
jsonValue, err := lab_utils.FileContentToString(relativePathToJSONSources + mne.configEntries[i].path)
jsonValue, err := lab_utils.ParseFileContent(relativePathToJSONSources + mne.configEntries[i].path)
if err != nil {
t.Error(err)
}
......
{
"openconfig-interfaces:config":{
"enabled":true,
"loopback-mode":false,
"mtu":1500,
"name":"eth1"
},
"openconfig-interfaces:name":"eth1",
"openconfig-interfaces:subinterfaces":{
"subinterface":[
{
"config":{
"enabled":true,
"index":0
},
"index":0,
"openconfig-if-ip:ipv4":{
"addresses":{
"address":[
{
"config":{
"ip":"10.50.0.1",
"prefix-length":30
},
"ip":"10.50.0.1"
}
]
},
"config":{
"enabled":true
}
}
}
]
}
}
"openconfig-interfaces:config":{
"enabled":true,
"loopback-mode":false,
"mtu":1500,
"name":"eth1"
},
"openconfig-interfaces:name":"eth1",
"openconfig-interfaces:subinterfaces":{
"subinterface":[
{
"config":{
"enabled":true,
"index":0
},
"index":0,
"openconfig-if-ip:ipv4":{
"addresses":{
"address":[
{
"config":{
"ip":"10.50.0.1",
"prefix-length":30
},
"ip":"10.50.0.1"
}
]
},
"config":{
"enabled":true
}
}
}
]
}
}
\ No newline at end of file
......@@ -105,7 +105,7 @@ func CreateAddListRequestSingleMne(addr, name, id, username, password string, pn
return alr
}
func SetInterfacePathListRequestSingleMne(networkInterface string, mneId string, operation mnepb.ApiOperation, newInterfaceConfig string, pndID string) (*mnepb.SetPathListRequest, error) {
func SetInterfacePathListRequestSingleMne(networkInterface string, mneId string, operation mnepb.ApiOperation, newInterfaceConfig []byte, pndID string) (*mnepb.SetPathListRequest, error) {
// Extract network interface
interfacePathString := "interfaces/interface[name=" + networkInterface + "]"
interfacePath, err := ygot.StringToStructuredPath(interfacePathString)
......@@ -113,6 +113,13 @@ func SetInterfacePathListRequestSingleMne(networkInterface string, mneId string,
return nil, err
}
// Create the yang path
typedValue := &gnmi.TypedValue{
Value: &gnmi.TypedValue_JsonIetfVal{
JsonIetfVal: newInterfaceConfig,
},
}
// Create PathListRequest
splr := &mnepb.SetPathListRequest{
Timestamp: integration_test_utils.GetTimestamp(),
......@@ -120,24 +127,18 @@ func SetInterfacePathListRequestSingleMne(networkInterface string, mneId string,
{
Mneid: mneId,
Path: interfacePath,
Value: &gnmi.TypedValue{
Value: &gnmi.TypedValue_StringVal{
StringVal: newInterfaceConfig,
},
},
Value: typedValue,
ApiOp: operation,
},
},
}
return splr, nil
}
func FileContentToString(path string) (string, error) {
func ParseFileContent(path string) ([]byte, error) {
fileContent, err := os.ReadFile(path)
if err != nil {
return "", err
return nil, err
}
return string(fileContent), nil
return fileContent, nil
}
......@@ -30,3 +30,13 @@ containerlab-slim-stop: create-clab-dir
containerlab-graph: create-clab-dir
cd $(CLAB_DIR) &&\
sudo containerlab graph --topo $(MAKEFILE_DIR)dev_env_data/clab/gosdn.clab.yaml
# TODO fix gitlab test ci/cd runner - must use containerlab image
containerlab-integration-tests-start: create-clab-dir containerize-all generate-all-certs
cd $(CLAB_DIR) &&\
sudo containerlab deploy --topo $(MAKEFILE_DIR)dev_env_data/clab/integration-tests.yaml --log-level debug
containerlab-integration-tests-stop: create-clab-dir
cd $(CLAB_DIR) &&\
sudo containerlab destroy --topo $(MAKEFILE_DIR)dev_env_data/clab/integration-tests.yaml
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment