Skip to content
Snippets Groups Projects
Commit f9ad623c authored by S.H.'s avatar S.H.
Browse files

Make launching twin optional through cli flag

parent 6f53eaf5
Branches
No related tags found
No related merge requests found
Pipeline #255747 failed
name: gosdn_csbi_arista_base_test-twin
mgmt:
network: gosdn_csbi_arista_base-test-twin
ipv4-subnet: 172.101.0.0/16
ipv6-subnet: 2001:db9::/64
mtu: 1500
topology:
nodes:
centos0-test-twin:
kind: linux
image: centos:8
mgmt-ipv4: 172.101.0.3
group: server
centos1-test-twin:
kind: linux
image: centos:8
mgmt-ipv4: 172.101.0.4
group: server
gnmi-target-switch0-test-twin:
kind: linux
image: registry.code.fbi.h-da.de/danet/gnmi-target/debian:master
ports:
- 7035: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.101.0.11
binds:
- ../../../artifacts/ssl/gnmi-target:/etc/gnmi-target/ssl
startup-delay: 5
gnmi-target-switch1-test-twin:
kind: linux
image: registry.code.fbi.h-da.de/danet/gnmi-target/debian:master
ports:
- 7036: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.101.0.12
binds:
- ../../../artifacts/ssl/gnmi-target:/etc/gnmi-target/ssl
startup-delay: 5
gosdn-test-twin:
kind: linux
image: gosdn
ports:
- 55060:55055
- 8085:8080
- 40005:40000
cmd: --config /app/configs/containerlab-gosdn.toml
mgmt-ipv4: 172.101.0.5
env:
GOSDN_ADMIN_PASSWORD: TestPassword
binds:
- ../../../artifacts/ssl/gosdn:/app/ssl
mongodb-express-test-twin:
kind: linux
image: mongo-express:1.0.2
ports:
- 8086:8081
mgmt-ipv4: 172.101.0.14
env:
ME_CONFIG_BASICAUTH: "false"
ME_CONFIG_MONGODB_AUTH_PASSWORD: example
ME_CONFIG_MONGODB_AUTH_USERNAME: root
ME_CONFIG_MONGODB_SERVER: mongodb
mongodb-test-twin:
kind: linux
image: mongo:7
ports:
- 27022:27017
mgmt-ipv4: 172.101.0.13
env:
MONGO_INITDB_ROOT_PASSWORD: example
MONGO_INITDB_ROOT_USERNAME: root
plugin-registry-test-twin:
kind: linux
image: plugin-registry
mgmt-ipv4: 172.101.0.16
rabbitmq-test-twin:
kind: linux
image: rabbitmq:3-management
ports:
- 127.0.0.1:5677:5672
- 127.0.0.1:15677:15672
mgmt-ipv4: 172.101.0.15
links:
- endpoints:
- gnmi-target-switch0-test-twin:eth1
- gnmi-target-switch1-test-twin:eth1
- endpoints:
- gnmi-target-switch0-test-twin:eth2
- centos0-test-twin:eth1
- endpoints:
- gnmi-target-switch1-test-twin:eth2
- centos1-test-twin:eth1
{
"openconfig-interfaces:interfaces": {
"interface": [
{
"config": {
"mtu": 1500,
"name": "eth0"
},
"name": "eth0",
"state": {
"admin-status": "UP",
"ifindex": 26,
"loopback-mode": false,
"oper-status": "UP"
},
"subinterfaces": {
"subinterface": [
{
"config": {
"index": 0
},
"index": 0,
"openconfig-if-ip:ipv4": {
"addresses": {
"address": [
{
"config": {
"ip": "172.100.0.12",
"prefix-length": 16
},
"ip": "172.100.0.12"
}
]
}
},
"openconfig-if-ip:ipv6": {
"addresses": {
"address": [
{
"config": {
"ip": "2001:db8::a",
"prefix-length": 64
},
"ip": "2001:db8::a"
}
]
}
}
},
{
"config": {
"index": 1
},
"index": 1,
"openconfig-if-ip:ipv6": {
"addresses": {
"address": [
{
"config": {
"ip": "fe80::42:acff:fe64:c",
"prefix-length": 64
},
"ip": "fe80::42:acff:fe64:c"
}
]
}
}
}
]
}
},
{
"config": {
"mtu": 9500,
"name": "eth1"
},
"name": "eth1",
"state": {
"admin-status": "UP",
"ifindex": 28,
"loopback-mode": false,
"oper-status": "UP"
},
"subinterfaces": {
"subinterface": [
{
"config": {
"index": 0
},
"index": 0,
"openconfig-if-ip:ipv6": {
"addresses": {
"address": [
{
"config": {
"ip": "fe80::a8c1:abff:fe61:a95f",
"prefix-length": 64
},
"ip": "fe80::a8c1:abff:fe61:a95f"
}
]
}
}
}
]
}
},
{
"config": {
"mtu": 9500,
"name": "eth2"
},
"name": "eth2",
"state": {
"admin-status": "UP",
"ifindex": 22,
"loopback-mode": false,
"oper-status": "UP"
},
"subinterfaces": {
"subinterface": [
{
"config": {
"index": 0
},
"index": 0,
"openconfig-if-ip:ipv6": {
"addresses": {
"address": [
{
"config": {
"ip": "fe80::a8c1:abff:fead:f866",
"prefix-length": 64
},
"ip": "fe80::a8c1:abff:fead:f866"
}
]
}
}
}
]
}
},
{
"config": {
"mtu": 0,
"name": "lo"
},
"name": "lo",
"state": {
"admin-status": "UP",
"ifindex": 1,
"loopback-mode": true,
"oper-status": "UNKNOWN"
},
"subinterfaces": {
"subinterface": [
{
"config": {
"index": 0
},
"index": 0,
"openconfig-if-ip:ipv4": {
"addresses": {
"address": [
{
"config": {
"ip": "127.0.0.1",
"prefix-length": 8
},
"ip": "127.0.0.1"
}
]
}
},
"openconfig-if-ip:ipv6": {
"addresses": {
"address": [
{
"config": {
"ip": "::1",
"prefix-length": 128
},
"ip": "::1"
}
]
}
}
}
]
}
}
]
},
"openconfig-network-instance:network-instances": {
"network-instance": [
{
"config": {
"name": "DEFAULT"
},
"name": "DEFAULT",
"protocols": {
"protocol": [
{
"config": {
"identifier": "openconfig-policy-types:STATIC",
"name": "STATIC"
},
"identifier": "openconfig-policy-types:STATIC",
"name": "STATIC",
"static-routes": {
"static": [
{
"config": {
"prefix": "0.0.0.0/0"
},
"next-hops": {
"next-hop": [
{
"config": {
"index": "AUTO_172.100.0.1",
"next-hop": "172.100.0.1"
},
"index": "AUTO_172.100.0.1",
"interface-ref": {
"config": {
"interface": "eth0"
}
}
}
]
},
"prefix": "0.0.0.0/0"
},
{
"config": {
"prefix": "::/0"
},
"next-hops": {
"next-hop": [
{
"config": {
"index": "AUTO_2001:db8::1",
"next-hop": "2001:db8::1"
},
"index": "AUTO_2001:db8::1",
"interface-ref": {
"config": {
"interface": "eth0"
}
}
}
]
},
"prefix": "::/0"
}
]
}
}
]
}
}
]
},
"openconfig-system:system": {
"clock": {
"config": {
"timezone-name": "UTC"
}
},
"config": {
"domain-name": "Not.implemented.yet",
"hostname": "gnmi-target-switch1",
"motd-banner": "\nThe programs included with the Debian GNU/Linux system are free software;\nthe exact distribution terms for each program are described in the\nindividual files in /usr/share/doc/*/copyright.\n\nDebian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent\npermitted by applicable law.\n"
},
"memory": {
"state": {
"free": "59508184",
"physical": "63586192",
"used": "4078008"
}
},
"state": {
"boot-time": "1738230616",
"current-datetime": "2025-01-30T10:07:31Z",
"software-version": "debian:12"
}
}
}
name: gosdn_csbi_arista_base_test-twin
mgmt:
network: gosdn_csbi_arista_base-test-twin
ipv4-subnet: 172.101.0.0/16
ipv6-subnet: 2001:db9::/64
mtu: 1500
topology:
nodes:
centos0-test-twin:
kind: linux
image: centos:8
mgmt-ipv4: 172.101.0.3
group: server
centos1-test-twin:
kind: linux
image: centos:8
mgmt-ipv4: 172.101.0.4
group: server
gnmi-target-switch0-test-twin:
kind: linux
image: registry.code.fbi.h-da.de/danet/gnmi-target/debian:master
ports:
- 7035: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.101.0.11
binds:
- ../../../artifacts/ssl/gnmi-target:/etc/gnmi-target/ssl
startup-delay: 5
gnmi-target-switch1-test-twin:
kind: linux
image: registry.code.fbi.h-da.de/danet/gnmi-target/debian:master
ports:
- 7036: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.101.0.12
binds:
- ../../../artifacts/ssl/gnmi-target:/etc/gnmi-target/ssl
startup-delay: 5
gosdn-test-twin:
kind: linux
image: gosdn
ports:
- 55060:55055
- 8085:8080
- 40005:40000
cmd: --config /app/configs/containerlab-gosdn.toml
mgmt-ipv4: 172.101.0.5
env:
GOSDN_ADMIN_PASSWORD: TestPassword
binds:
- ../../../artifacts/ssl/gosdn:/app/ssl
mongodb-express-test-twin:
kind: linux
image: mongo-express:1.0.2
ports:
- 8086:8081
mgmt-ipv4: 172.101.0.14
env:
ME_CONFIG_BASICAUTH: "false"
ME_CONFIG_MONGODB_AUTH_PASSWORD: example
ME_CONFIG_MONGODB_AUTH_USERNAME: root
ME_CONFIG_MONGODB_SERVER: mongodb
mongodb-test-twin:
kind: linux
image: mongo:7
ports:
- 27022:27017
mgmt-ipv4: 172.101.0.13
env:
MONGO_INITDB_ROOT_PASSWORD: example
MONGO_INITDB_ROOT_USERNAME: root
plugin-registry-test-twin:
kind: linux
image: plugin-registry
mgmt-ipv4: 172.101.0.16
rabbitmq-test-twin:
kind: linux
image: rabbitmq:3-management
ports:
- 127.0.0.1:5677:5672
- 127.0.0.1:15677:15672
mgmt-ipv4: 172.101.0.15
links:
- endpoints:
- gnmi-target-switch0-test-twin:eth1
- gnmi-target-switch1-test-twin:eth1
- endpoints:
- gnmi-target-switch0-test-twin:eth2
- centos0-test-twin:eth1
- endpoints:
- gnmi-target-switch1-test-twin:eth2
- centos1-test-twin:eth1
...@@ -24,6 +24,7 @@ func main() { ...@@ -24,6 +24,7 @@ func main() {
var user string var user string
var topology_file string var topology_file string
var generate bool var generate bool
var withTwin bool
flag.StringVar(&address, "address", "172.100.0.5:55055", "Address of the gosdn controller") flag.StringVar(&address, "address", "172.100.0.5:55055", "Address of the gosdn controller")
flag.StringVar(&address, "a", "172.100.0.5:55055", "Address of the gosdn controller (shorthand)") flag.StringVar(&address, "a", "172.100.0.5:55055", "Address of the gosdn controller (shorthand)")
flag.StringVar(&pass, "password", "TestPassword", "Password for admin user") flag.StringVar(&pass, "password", "TestPassword", "Password for admin user")
...@@ -32,6 +33,7 @@ func main() { ...@@ -32,6 +33,7 @@ func main() {
flag.StringVar(&user, "u", "admin", "Username (shorthand)") flag.StringVar(&user, "u", "admin", "Username (shorthand)")
flag.BoolVar(&generate, "generate", false, "Whether to start the realnet containerlab environment ourselves") flag.BoolVar(&generate, "generate", false, "Whether to start the realnet containerlab environment ourselves")
flag.BoolVar(&generate, "g", false, "Whether to start the realnet containerlab environment ourselves (shorthand)") flag.BoolVar(&generate, "g", false, "Whether to start the realnet containerlab environment ourselves (shorthand)")
flag.BoolVar(&withTwin, "with-twin", false, "Whether to start a twin")
flag.StringVar(&topology_file, "topology", "data/clab.yaml", "Containerlab file on the basis of which to create topo") flag.StringVar(&topology_file, "topology", "data/clab.yaml", "Containerlab file on the basis of which to create topo")
flag.StringVar(&topology_file, "t", "data/clab.yaml", "Containerlab file on the basis of which to create topo (shorthand)") flag.StringVar(&topology_file, "t", "data/clab.yaml", "Containerlab file on the basis of which to create topo (shorthand)")
...@@ -42,6 +44,7 @@ func main() { ...@@ -42,6 +44,7 @@ func main() {
fmt.Println("--password, -p: Password for the user to log into realnet as") fmt.Println("--password, -p: Password for the user to log into realnet as")
fmt.Println("--topology, -t: Topology .yaml file to use to generate realnet and twins") fmt.Println("--topology, -t: Topology .yaml file to use to generate realnet and twins")
fmt.Println("--generate, -g: Whether to start the realnet containerlab environment ourselves") fmt.Println("--generate, -g: Whether to start the realnet containerlab environment ourselves")
fmt.Println("--with-twin: Whether to start the realnet containerlab environment for the twin")
} }
flag.Parse() flag.Parse()
fmt.Println("Topology file path: ", topology_file) fmt.Println("Topology file path: ", topology_file)
...@@ -68,7 +71,9 @@ func main() { ...@@ -68,7 +71,9 @@ func main() {
fmt.Println("Couldn't initialize rtdt-manager, quitting!") fmt.Println("Couldn't initialize rtdt-manager, quitting!")
return return
} }
rtdtMan.LaunchTwin("172.101.0.0/16", "2001:db9::/64", "test-twin") if withTwin {
rtdtMan.LaunchTwin("172.101.0.0/16", "2001:db9::/64", "test-twin")
}
if err := rtdtMan.Run(); err != nil { if err := rtdtMan.Run(); err != nil {
fmt.Println("Program exited with errors: %w", err) fmt.Println("Program exited with errors: %w", err)
} }
......
...@@ -132,6 +132,7 @@ func NewVEnv(name, topoYamlFile, user, pass string, wg *sync.WaitGroup) *VEnv { ...@@ -132,6 +132,7 @@ func NewVEnv(name, topoYamlFile, user, pass string, wg *sync.WaitGroup) *VEnv {
waitGroup: wg, waitGroup: wg,
} }
} }
func (v *VEnv) InitEventSystem() error { func (v *VEnv) InitEventSystem() error {
realnet_auth := v.auth realnet_auth := v.auth
...@@ -177,15 +178,19 @@ func (v *VEnv) InitEventSystem() error { ...@@ -177,15 +178,19 @@ func (v *VEnv) InitEventSystem() error {
} }
func (v *VEnv) updateMNECallback(event *event.Event) { func (v *VEnv) updateMNECallback(event *event.Event) {
fmt.Println("MNE Event has happened (type: update), hurray!") fmt.Println("--------------------------------")
fmt.Println("---------- MNE EVENT -----------")
fmt.Println("EventID: ", event.ID.ID()) fmt.Println("EventID: ", event.ID.ID())
fmt.Println("Event Type: ", event.Type) fmt.Println("Event Type: ", event.Type)
fmt.Println("PathsAndValuesMap: ", event.PathsAndValuesMap)
} }
func (v *VEnv) userEventCallback(event *event.Event) { func (v *VEnv) userEventCallback(event *event.Event) {
fmt.Println("User Event has happened (type: update), hurray!") fmt.Println("--------------------------------")
fmt.Println("---------- USER EVENT ----------")
fmt.Println("EventID: ", event.ID.ID()) fmt.Println("EventID: ", event.ID.ID())
fmt.Println("Event Type: ", event.Type) fmt.Println("Event Type: ", event.Type)
fmt.Println("PathsAndValuesMap: ", event.PathsAndValuesMap)
} }
// For later, topology stuff // For later, topology stuff
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment