blob: 8ce744619d7780752418a0af9489f98e7cfdc2e2 [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 (
donNewtonAlpha1d2d6812018-09-14 16:00:02 -040020 "net"
21 "testing"
22
23 "gerrit.opencord.org/abstract-olt/models/tosca"
24)
25
26var expected = `tosca_definitions_version: tosca_simple_yaml_1_0
27imports:
28- custom_types/attworkflowdriverwhitelistentry.yaml
29- custom_types/attworkflowdriverservice.yaml
30description: Create an entry in the whitelist
31topology_template:
32 node_templates:
33 service#att:
34 type: tosca.nodes.AttWorkflowDriverService
35 properties:
36 name: att-workflow-driver
37 must-exist: true
38 some_serial:
39 type: tosca.nodes.AttWorkflowDriverWhiteListEntry
40 properties:
41 serial_number: some_serial
donNewtonAlphae7ab5b92018-09-27 15:09:14 -040042 pon_port_id: 536870913
donNewtonAlpha1d2d6812018-09-14 16:00:02 -040043 device_id: of:00000000c0a8010b
44 requirements:
45 - owner:
46 node: service#att
47 relationship: tosca.relationships.BelongsToOne
48`
49var ont tosca.OntProvision
50
51//func NewOntProvision(serialNumber string, oltIP net.IP, ponPortNumber int) OntProvision {
52
53func TestOntProvision_NewOntProvision(t *testing.T) {
54 ont = tosca.NewOntProvision("some_serial", net.ParseIP("192.168.1.11"), 2)
55 ontYaml, _ := ont.ToYaml()
56 if ontYaml != expected {
57 t.Fatalf("Didn't generate the expected yaml\n Generated:\n%s \nExpected:\n%s\n", ontYaml, expected)
58 }
donNewtonAlpha1d2d6812018-09-14 16:00:02 -040059}