Release of Routing Manager v0.3.0
[ric-plt/rtmgr.git] / pkg / rpe / rmr_test.go
1 /*
2 ==================================================================================
3    Copyright (c) 2019 AT&T Intellectual Property.
4    Copyright (c) 2019 Nokia
5
6    Licensed under the Apache License, Version 2.0 (the "License");
7    you may not use this file except in compliance with the License.
8    You may obtain a copy of the License at
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
12    Unless required by applicable law or agreed to in writing, software
13    distributed under the License is distributed on an "AS IS" BASIS,
14    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15    See the License for the specific language governing permissions and
16    limitations under the License.
17 ==================================================================================
18 */
19 /*
20         Mnemonic:       nngpub_test.go
21         Abstract:
22         Date:           25 April 2019
23 */
24 package rpe
25
26 import (
27         "routing-manager/pkg/rtmgr"
28         "routing-manager/pkg/stub"
29         "testing"
30 )
31
32 func resetTestDataset(testdata []rtmgr.Endpoint) {
33         rtmgr.Eps = make(map[string]*rtmgr.Endpoint)
34         for _, endpoint := range stub.ValidEndpoints {
35                 ep := endpoint
36                 rtmgr.Eps[ep.Uuid] = &ep
37         }
38 }
39
40 /*
41 RmrPub.GeneratePolicies() method is tested for happy path case
42 */
43 func TestRmrPubGeneratePolicies(t *testing.T) {
44         var rmrpub = RmrPub{}
45         resetTestDataset(stub.ValidEndpoints)
46
47         rawrt := rmrpub.GeneratePolicies(rtmgr.Eps)
48         t.Log(rawrt)
49 }
50
51 /*
52 RmrPush.GeneratePolicies() method is tested for happy path case
53 */
54 func TestRmrPushGeneratePolicies(t *testing.T) {
55         var rmrpush = RmrPush{}
56         resetTestDataset(stub.ValidEndpoints)
57
58         rawrt := rmrpush.GeneratePolicies(rtmgr.Eps)
59         t.Log(rawrt)
60 }