diff --git a/controller.go b/controller.go index f7f90f4668d26dbf9f7cfee92f58775b9c8ac592..961821e9fdf3f17ec9b88d7d7099acc8640a1c2f 100644 --- a/controller.go +++ b/controller.go @@ -92,7 +92,20 @@ func createSouthboundInterfaces() error { // createPrincipalNetworkDomain initializes the controller with an initial PND func createPrincipalNetworkDomain(s southbound.SouthboundInterface) error { - pnd, err := nucleus.NewPND("base", "gosdn base pnd", uuid.New(), s) + var pndUUID uuid.UUID + + // Check if there is already an PND. + pndUUIDAsString := viper.GetString("pnd") + if pndUUIDAsString == "" { + pndUUID = uuid.New() + } + + pndUUID, err := uuid.Parse(pndUUIDAsString) + if err != nil { + return err + } + + pnd, err := nucleus.NewPND("base", "gosdn base pnd", pndUUID, s) if err != nil { return err }