From 969155bb9059b7fa87442175dddc3d64dec44235 Mon Sep 17 00:00:00 2001
From: Malte Bauch <malte.bauch@stud.h-da.de>
Date: Wed, 30 Sep 2020 13:25:15 +0200
Subject: [PATCH] added hardcoded PND to database.StoreNodes()

this is for test purpose only and should be changed as soon as possible.
---
 database/database.go            | 8 ++++++--
 restconf/client/ciena/client.go | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/database/database.go b/database/database.go
index 461a1e878..cdc2da22c 100644
--- a/database/database.go
+++ b/database/database.go
@@ -83,7 +83,11 @@ func (d Database) RemovePND(id string) {
 
 //StoreNodes stores the given nodes to the database and adds them to a
 //principle networt domain (PND). It is required for a node to belong to a PND.
-func (d Database) StoreNodes(json, pndID string) {
+func (d Database) StoreNodes(json string) {
+	//TODO: remove this after testing and add own gRPC call for it
+	testPND := PND{name: "test_PND", description: "very, interesting", southboundInterfaces: []string{"TAPI", "RESTCONF"}}
+	d.StorePND(&testPND)
+
 	query :=
 		`
 		WITH apoc.convert.fromJsonMap($stringToAdd)
@@ -104,7 +108,7 @@ func (d Database) StoreNodes(json, pndID string) {
 	_, err := d.session.Run(
 		query, map[string]interface{}{
 			"stringToAdd": json,
-			"pnd":         pndID,
+			"pnd":         testPND.name,
 		})
 
 	logError("failed storing Nodes into database", err)
diff --git a/restconf/client/ciena/client.go b/restconf/client/ciena/client.go
index 1dea66548..cb514e37a 100644
--- a/restconf/client/ciena/client.go
+++ b/restconf/client/ciena/client.go
@@ -57,10 +57,10 @@ func (c *MCPClient) GetConnections() error {
 	return err
 }
 
-func (c *MCPClient) GetNodes(pndName string) error {
+func (c *MCPClient) GetNodes() error {
 	defer c.buffer.Reset()
 	_, err := c.client.TapiTopologyCore.GetTapiCoreContextTopologyMcpBaseTopologyNode(nil)
-	c.database.StoreNodes(c.buffer.String(), pndName)
+	c.database.StoreNodes(c.buffer.String())
 	log.Debug(c.buffer.Next(25))
 	return err
 }
-- 
GitLab