donNewtonAlpha | b9b85eb | 2018-08-14 14:28:22 -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 api_test |
| 18 | |
| 19 | import ( |
| 20 | "fmt" |
| 21 | "testing" |
| 22 | |
| 23 | "gerrit.opencord.org/abstract-olt/api" |
| 24 | "golang.org/x/net/context" |
| 25 | ) |
| 26 | |
| 27 | var clli string |
| 28 | var ctx context.Context |
| 29 | var server api.Server |
| 30 | |
| 31 | func TestHandler_CreateChassis(t *testing.T) { |
| 32 | fmt.Println("in handlerTest_CreateChassis") |
| 33 | ctx = context.Background() |
| 34 | server = api.Server{} |
| 35 | message := &api.AddChassisMessage{CLLI: "my cilli", VCoreIP: "192.168.0.1", VCorePort: 9191} |
| 36 | ret, err := server.CreateChassis(ctx, message) |
| 37 | if err != nil { |
| 38 | t.Fatalf("CreateChassis failed %v\n", err) |
| 39 | } |
| 40 | clli = ret.DeviceID |
| 41 | |
| 42 | } |
| 43 | func TestHandler_CreateOLTChassis(t *testing.T) { |
| 44 | message := &api.AddOLTChassisMessage{CLLI: clli, SlotIP: "12.2.2.0", SlotPort: 9191, |
| 45 | Hostname: "SlotOne", Type: api.AddOLTChassisMessage_edgecore} |
| 46 | ret, err := server.CreateOLTChassis(ctx, message) |
| 47 | if err != nil { |
| 48 | t.Fatalf("CreateOLTChassis failed %v\n", err) |
| 49 | } |
| 50 | fmt.Printf("CreateOLTChassis success %v\n", ret) |
| 51 | |
| 52 | } |