From 7e580a307130a89cf59263dbe57ab41e5b1ea59b Mon Sep 17 00:00:00 2001 From: TangBin Date: Sat, 13 Oct 2018 10:30:39 +0800 Subject: [PATCH] add network --- pkg/util/aws/aws_test.go | 2 -- pkg/util/aws/wire.go | 28 ++++++++++++++++++---------- 2 files changed, 18 insertions(+), 12 deletions(-) delete mode 100644 pkg/util/aws/aws_test.go diff --git a/pkg/util/aws/aws_test.go b/pkg/util/aws/aws_test.go deleted file mode 100644 index c3391515b0..0000000000 --- a/pkg/util/aws/aws_test.go +++ /dev/null @@ -1,2 +0,0 @@ -package aws - diff --git a/pkg/util/aws/wire.go b/pkg/util/aws/wire.go index 7a406397d1..a529c4bc5f 100644 --- a/pkg/util/aws/wire.go +++ b/pkg/util/aws/wire.go @@ -3,6 +3,7 @@ package aws import ( "yunion.io/x/onecloud/pkg/cloudprovider" "yunion.io/x/jsonutils" + "fmt" ) type SWire struct { @@ -13,43 +14,50 @@ type SWire struct { } func (self *SWire) GetId() string { - panic("implement me") + return fmt.Sprintf("%s-%s", self.vpc.GetId(), self.zone.GetId()) } func (self *SWire) GetName() string { - panic("implement me") + return self.GetId() } func (self *SWire) GetGlobalId() string { - panic("implement me") + return fmt.Sprintf("%s-%s", self.vpc.GetGlobalId(), self.zone.GetGlobalId()) } func (self *SWire) GetStatus() string { - panic("implement me") + return "available" } func (self *SWire) Refresh() error { - panic("implement me") + return nil } func (self *SWire) IsEmulated() bool { - panic("implement me") + return true } func (self *SWire) GetMetadata() *jsonutils.JSONDict { - panic("implement me") + return nil } func (self *SWire) GetIVpc() cloudprovider.ICloudVpc { - panic("implement me") + return self.vpc } func (self *SWire) GetIZone() cloudprovider.ICloudZone { - panic("implement me") + return self.zone } func (self *SWire) GetINetworks() ([]cloudprovider.ICloudNetwork, error) { - panic("implement me") + if self.inetworks == nil { + // todo: vpc.fetchVSwitches() + // err := self.vpc.fetchVSwitches() + // if err != nil { + return nil, nil + // } + } + return self.inetworks, nil } func (self *SWire) GetBandwidth() int {