bug fixes
Change-Id: Ie29671901d49038dc1ae1915cddef21d2b6479fc
(cherry picked from commit 0e64b59b2e1cc82e72f853bcbc94987de23a9ea7)
diff --git a/config-generator/Dockerfile b/config-generator/Dockerfile
index 538ed40..0aa2d4d 100644
--- a/config-generator/Dockerfile
+++ b/config-generator/Dockerfile
@@ -31,10 +31,10 @@
RUN go install gerrit.opencord.org/maas/config-generator
# copy templates to the image
-COPY hosts.tpl /go/bin/
-COPY links.tpl /go/bin/
-COPY ports.tpl /go/bin/
-COPY devices.tpl /go/bin/
+COPY hosts.tpl /go/
+COPY links.tpl /go/
+COPY ports.tpl /go/
+COPY devices.tpl /go/
EXPOSE 1337
diff --git a/config-generator/Makefile b/config-generator/Makefile
index ea30963..f06879f 100644
--- a/config-generator/Makefile
+++ b/config-generator/Makefile
@@ -19,10 +19,10 @@
go test -cover -v ./...
image:
- docker build -t gunjan5/configGen .
+ docker build -t config-gen .
run:
- docker run --rm -it gunjan5/configGen
+ docker run --rm -p 1337:1337 -it config-gen
build:
GOOS=linux GOARCH=amd64 go build -o app
diff --git a/config-generator/configGen.go b/config-generator/configGen.go
index 4b9f40a..bcc3ddd 100644
--- a/config-generator/configGen.go
+++ b/config-generator/configGen.go
@@ -30,8 +30,8 @@
type Config struct {
Port string `default:"8181"`
IP string `default:"127.0.0.1"`
- SwitchCount int `default:"4"`
- HostCount int `default:"4"`
+ SwitchCount int `default:"0"`
+ HostCount int `default:"0"`
Username string `default:"karaf"`
Password string `default:"karaf"`
LogLevel string `default:"warning" envconfig:"LOG_LEVEL"`
diff --git a/config-generator/devices.tpl b/config-generator/devices.tpl
index 2bb0e27..66ef4d9 100644
--- a/config-generator/devices.tpl
+++ b/config-generator/devices.tpl
@@ -1,12 +1,12 @@
{
"devices" : {
-{{ range . }}
+{{ range $index, $element := . }}
"{{ .Id}}" : {
"segmentrouting" : {
"name" : "device-{{ .ChassisId }}",
- "nodeSid" : 1{{ .ChassisId }},
+ "nodeSid" : 10{{ $index }},
"routerIp" : "{{ .Annotations.ManagementAddress }}",
- "routerMac" : "cc:37:ab:cc:ef:{{ .ChassisId }}",
+ "routerMac" : "cc:37:ab:00:00:0{{ $index }}",
"isEdgeRouter" : true,
"adjacencySids" : []
}
diff --git a/config-generator/network-cfg.json b/config-generator/network-cfg.json
index c074e37..0fd3906 100644
--- a/config-generator/network-cfg.json
+++ b/config-generator/network-cfg.json
@@ -4,9 +4,9 @@
"of:0000000000000021" : {
"segmentrouting" : {
"name" : "device-21",
- "nodeSid" : 121,
+ "nodeSid" : 100,
"routerIp" : "10.6.0.7",
- "routerMac" : "cc:37:ab:cc:ef:21",
+ "routerMac" : "cc:37:ab:00:00:00",
"isEdgeRouter" : true,
"adjacencySids" : []
}
@@ -14,9 +14,9 @@
"of:0000000000000011" : {
"segmentrouting" : {
"name" : "device-11",
- "nodeSid" : 111,
+ "nodeSid" : 101,
"routerIp" : "10.6.0.6",
- "routerMac" : "cc:37:ab:cc:ef:11",
+ "routerMac" : "cc:37:ab:00:00:01",
"isEdgeRouter" : true,
"adjacencySids" : []
}
@@ -24,9 +24,9 @@
"of:0000000000000022" : {
"segmentrouting" : {
"name" : "device-22",
- "nodeSid" : 122,
+ "nodeSid" : 102,
"routerIp" : "10.6.0.10",
- "routerMac" : "cc:37:ab:cc:ef:22",
+ "routerMac" : "cc:37:ab:00:00:02",
"isEdgeRouter" : true,
"adjacencySids" : []
}
@@ -34,9 +34,9 @@
"of:0000000000000012" : {
"segmentrouting" : {
"name" : "device-12",
- "nodeSid" : 112,
+ "nodeSid" : 103,
"routerIp" : "10.6.0.8",
- "routerMac" : "cc:37:ab:cc:ef:12",
+ "routerMac" : "cc:37:ab:00:00:03",
"isEdgeRouter" : true,
"adjacencySids" : []
}