yunion.io/x/cloudmux@v0.3.10-0-alpha.1/pkg/multicloud/esxi/hostnic.go (about) 1 // Copyright 2019 Yunion 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package esxi 16 17 import ( 18 "yunion.io/x/pkg/tristate" 19 ) 20 21 type SHostNicInfo struct { 22 Dev string 23 Driver string 24 Mac string 25 Index int8 26 LinkUp bool 27 IpAddr string 28 IpAddr6 string 29 Mtu int32 30 NicType string 31 32 DVPortGroup string 33 34 IpAddrPrefixLen int8 35 IpAddr6PrefixLen int8 36 } 37 38 func (nic *SHostNicInfo) GetDevice() string { 39 return nic.Dev 40 } 41 42 func (nic *SHostNicInfo) GetDriver() string { 43 return nic.Driver 44 } 45 46 func (nic *SHostNicInfo) GetMac() string { 47 return nic.Mac 48 } 49 50 func (nic *SHostNicInfo) GetIndex() int8 { 51 return nic.Index 52 } 53 54 func (nic *SHostNicInfo) IsLinkUp() tristate.TriState { 55 if nic.LinkUp { 56 return tristate.True 57 } 58 return tristate.False 59 } 60 61 func (nic *SHostNicInfo) GetIpAddr() string { 62 return nic.IpAddr 63 } 64 65 func (nic *SHostNicInfo) GetIpAddrPrefixLen() int8 { 66 return nic.IpAddrPrefixLen 67 } 68 69 func (nic *SHostNicInfo) GetIpAddr6() string { 70 return nic.IpAddr6 71 } 72 73 func (nic *SHostNicInfo) GetIpAddr6PrefixLen() int8 { 74 return nic.IpAddr6PrefixLen 75 } 76 77 func (nic *SHostNicInfo) GetMtu() int32 { 78 return nic.Mtu 79 } 80 81 func (nic *SHostNicInfo) GetNicType() string { 82 return nic.NicType 83 } 84 85 func (nic *SHostNicInfo) GetDVPortGroup() string { 86 return nic.DVPortGroup 87 } 88 89 func (nic *SHostNicInfo) GetBridge() string { 90 return nic.DVPortGroup 91 }