// 2019 Rackspace, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"): you may // not use this file except in compliance with the License. You may obtain // a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the // License for the specific language governing permissions and limitations // under the License. package hypsnet import ( "testing" "github.rackspace.com/gorax/gokeys" ) func TestGetDeviceList_ParseServiceNet(t *testing.T) { cfg, err := gokeys.New(nil) if err != nil { t.Fatalf("gokeys.New:%s", err) } key, err := cfg.Core(false) if err != nil { t.Fatal(err) } r, err := getDeviceList("IAD2-MG-07", key.Password, "iad2") if err != nil { t.Fatal(err) } if len(r) == 0 { t.Fatalf("ERROR: no devices returned") } t.Logf("SUCCESS: found %d hyps for move-group", len(r)) for _, config := range parseServiceNet(r, "iad3") { t.Logf("SUCCESS: found %d ServiceNet vlans for %s", len(config.SNetVlans), config.Number) for _, v := range config.SNetVlans { t.Logf("SUCCESS:%s: SNet vlan: %s:%d (%s)", config.Number, v.Source.ZoneName, v.Source.VlanNumber, v.Source.NetworkSegments) } // nolint:staticcheck return } }