donNewtonAlpha | 1d2d681 | 2018-09-14 16:00:02 -0400 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package tosca_test |
| 18 | |
| 19 | import ( |
donNewtonAlpha | 1d2d681 | 2018-09-14 16:00:02 -0400 | [diff] [blame] | 20 | "net" |
| 21 | "testing" |
| 22 | |
| 23 | "gerrit.opencord.org/abstract-olt/models/tosca" |
| 24 | ) |
| 25 | |
| 26 | var expected = `tosca_definitions_version: tosca_simple_yaml_1_0 |
| 27 | imports: |
| 28 | - custom_types/attworkflowdriverwhitelistentry.yaml |
| 29 | - custom_types/attworkflowdriverservice.yaml |
| 30 | description: Create an entry in the whitelist |
| 31 | topology_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 |
donNewtonAlpha | e7ab5b9 | 2018-09-27 15:09:14 -0400 | [diff] [blame] | 42 | pon_port_id: 536870913 |
donNewtonAlpha | 1d2d681 | 2018-09-14 16:00:02 -0400 | [diff] [blame] | 43 | device_id: of:00000000c0a8010b |
| 44 | requirements: |
| 45 | - owner: |
| 46 | node: service#att |
| 47 | relationship: tosca.relationships.BelongsToOne |
| 48 | ` |
| 49 | var ont tosca.OntProvision |
| 50 | |
| 51 | //func NewOntProvision(serialNumber string, oltIP net.IP, ponPortNumber int) OntProvision { |
| 52 | |
| 53 | func 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 | } |
donNewtonAlpha | 1d2d681 | 2018-09-14 16:00:02 -0400 | [diff] [blame] | 59 | } |