// VLANs retrieves the list of child VLANs of the VsgRedundantPort
519108
func (o *VsgRedundantPort) VLANs(info *bambou.FetchingInfo) (VLANsList, *bambou.Error) {

	var list VLANsList
	err := bambou.CurrentSession().FetchChildren(o, VLANIdentity, &list, info)
	return list, err
}
250443
func (r Network_Gateway) UnbypassVlans(vlans []datatypes.Network_Gateway_Vlan) (err error) {
	var resp datatypes.Void
	params := []interface{}{
		vlans,
	}
	err = r.Session.DoRequest("SoftLayer_Network_Gateway", "unbypassVlans", params, &r.Options, &resp)
	return
}
662219
func (gc *Cfg) FreeVLAN(vlan uint) error {
	tempRm, err := resources.GetStateResourceManager()
	if err != nil {
		return err
	}
	ra := core.ResourceManager(tempRm)

	return ra.DeallocateResourceVal("global", resources.AutoVLANResource, vlan)
}
1126424
func (s *SeesawECU) Vservers(ctx *ipc.Context, reply *seesaw.VserverMap) error {
	s.trace("Vservers", ctx)

	authConn, err := s.ecu.authConnect(ctx)
	if err != nil {
		return err
	}
	defer authConn.Close()

	vservers, err := authConn.Vservers()
	if err != nil {
		return err
	}

	if reply != nil {
		reply.Vservers = vservers
	}
	return nil
}
1019614
func ifaceDelVLAN(iface *net.Interface, vlan *seesaw.VLAN) error {
	name := fmt.Sprintf("%s.%d", iface.Name, vlan.ID)
	vlanIface, err := net.InterfaceByName(name)
	if err != nil {
		return fmt.Errorf("Failed to find VLAN interface %q: %v", name, err)
	}
	return ipRunIface(vlanIface, "link del dev %s", vlanIface.Name)
}
393482
func (s *SeesawEngine) VLANs(ctx *ipc.Context, reply *seesaw.VLANs) error {
	s.trace("VLANs", ctx)
	if ctx == nil {
		return errors.New("context is nil")
	}

	if !ctx.IsTrusted() {
		return errors.New("insufficient access")
	}

	if reply == nil {
		return errors.New("VLANs is nil")
	}
	reply.VLANs = make([]*seesaw.VLAN, 0)
	s.engine.vlanLock.RLock()
	for _, vlan := range s.engine.vlans {
		reply.VLANs = append(reply.VLANs, vlan)
	}
	s.engine.vlanLock.RUnlock()
	return nil
}
361539
func (o *PortTemplate) VLANTemplates(info *bambou.FetchingInfo) (VLANTemplatesList, *bambou.Error) {

	var list VLANTemplatesList
	err := bambou.CurrentSession().FetchChildren(o, VLANTemplateIdentity, &list, info)
	return list, err
}
1295732
func (a *APIAddresser) APIHostPorts() ([][]network.HostPort, error) {
	var result params.APIHostPortsResult
	err := a.facade.FacadeCall("APIHostPorts", nil, &result)
	if err != nil {
		return nil, err
	}
	return result.NetworkHostsPorts(), nil
}
1079115
func defaultHostNetworkPorts(containers *[]Container) {
	for i := range *containers {
		for j := range (*containers)[i].Ports {
			if (*containers)[i].Ports[j].HostPort == 0 {
				(*containers)[i].Ports[j].HostPort = (*containers)[i].Ports[j].ContainerPort
			}
		}
	}
}
1121565
func (o *RedundancyGroup) CreateVsgRedundantPort(child *VsgRedundantPort) *bambou.Error {

	return bambou.CurrentSession().CreateChild(o, child)
}
1006350
func (r Network_Vlan) GetTotalPrimaryIpAddressCount() (resp uint, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Vlan", "getTotalPrimaryIpAddressCount", nil, &r.Options, &resp)
	return
}
153386
func listVLANs(c context.Context, ids map[int64]struct{}, aliases stringset.Set) ([]*crimson.VLAN, error) {
	db := database.Get(c)
	rows, err := db.QueryContext(c, `
		SELECT id, alias, state, cidr_block
		FROM vlans
	`)
	if err != nil {
		return nil, errors.Annotate(err, "failed to fetch VLANs").Err()
	}
	defer rows.Close()

	var vlans []*crimson.VLAN
	for rows.Next() {
		vlan := &crimson.VLAN{}
		if err = rows.Scan(&vlan.Id, &vlan.Alias, &vlan.State, &vlan.CidrBlock); err != nil {
			return nil, errors.Annotate(err, "failed to fetch VLAN").Err()
		}
		// VLAN may match either the given IDs or aliases.
		// If both IDs and aliases are empty, consider all VLANs to match.
		if _, ok := ids[vlan.Id]; ok || aliases.Has(vlan.Alias) || (len(ids) == 0 && aliases.Len() == 0) {
			vlans = append(vlans, vlan)
		}
	}
	return vlans, nil
}
520127
func (s *VirtualInterface) SetVlan(v int64) *VirtualInterface {
	s.Vlan = &v
	return s
}
770966
func (s *NewPrivateVirtualInterfaceAllocation) SetVlan(v int64) *NewPrivateVirtualInterfaceAllocation {
	s.Vlan = &v
	return s
}
807813
func (r Account) GetNetworkVlanSpan() (resp datatypes.Account_Network_Vlan_Span, err error) {
	err = r.Session.DoRequest("SoftLayer_Account", "getNetworkVlanSpan", nil, &r.Options, &resp)
	return
}
500906
func (e *Engine) deleteVLANs() {
	if err := e.ncc.Dial(); err != nil {
		log.Fatalf("Failed to connect to NCC: %v", err)
	}
	defer e.ncc.Close()

	e.vlanLock.Lock()
	defer e.vlanLock.Unlock()

	for k, v := range e.vlans {
		if err := e.lbInterface.DeleteVLAN(v); err != nil {
			log.Fatalf("Failed to remove VLAN interface %v: %v", v, err)
		}
		delete(e.vlans, k)
	}
}
716569
func (s *NewTransitVirtualInterfaceAllocation) SetVlan(v int64) *NewTransitVirtualInterfaceAllocation {
	s.Vlan = &v
	return s
}