blob: ff7cd8580dba06d05ca16260dda93791d0d6459e [file] [log] [blame]
donNewtonAlpha1d2d6812018-09-14 16:00:02 -04001/*
2 Copyright 2017 the original author or authors.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17package tosca_test
18
19import (
20 "fmt"
21 "net"
22 "testing"
23
24 "gerrit.opencord.org/abstract-olt/models/tosca"
25)
26
27var expected = `tosca_definitions_version: tosca_simple_yaml_1_0
28imports:
29- custom_types/attworkflowdriverwhitelistentry.yaml
30- custom_types/attworkflowdriverservice.yaml
31description: Create an entry in the whitelist
32topology_template:
33 node_templates:
34 service#att:
35 type: tosca.nodes.AttWorkflowDriverService
36 properties:
37 name: att-workflow-driver
38 must-exist: true
39 some_serial:
40 type: tosca.nodes.AttWorkflowDriverWhiteListEntry
41 properties:
42 serial_number: some_serial
43 pon_port_id: 536870914
44 device_id: of:00000000c0a8010b
45 requirements:
46 - owner:
47 node: service#att
48 relationship: tosca.relationships.BelongsToOne
49`
50var ont tosca.OntProvision
51
52//func NewOntProvision(serialNumber string, oltIP net.IP, ponPortNumber int) OntProvision {
53
54func TestOntProvision_NewOntProvision(t *testing.T) {
55 ont = tosca.NewOntProvision("some_serial", net.ParseIP("192.168.1.11"), 2)
56 ontYaml, _ := ont.ToYaml()
57 if ontYaml != expected {
58 t.Fatalf("Didn't generate the expected yaml\n Generated:\n%s \nExpected:\n%s\n", ontYaml, expected)
59 }
60 fmt.Println(ontYaml)
61 fmt.Println("******************")
62}