• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Golang utils.GetStateDriver函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/contiv/netplugin/utils.GetStateDriver函数的典型用法代码示例。如果您正苦于以下问题:Golang GetStateDriver函数的具体用法?Golang GetStateDriver怎么用?Golang GetStateDriver使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetStateDriver函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: IsAciConfigured

// IsAciConfigured returns true if aci is configured on netmaster.
func IsAciConfigured() (res bool, err error) {
	// Get the state driver
	stateDriver, uErr := utils.GetStateDriver()
	if uErr != nil {
		log.Warnf("Couldn't read global config %v", uErr)
		return false, uErr
	}

	// read global config
	masterGc := &mastercfg.GlobConfig{}
	masterGc.StateDriver = stateDriver
	uErr = masterGc.Read("config")
	if core.ErrIfKeyExists(uErr) != nil {
		log.Errorf("Couldn't read global config %v", uErr)
		return false, uErr
	}

	if uErr != nil {
		log.Warnf("Couldn't read global config %v", uErr)
		return false, nil
	}

	if masterGc.NwInfraType != "aci" {
		log.Debugf("NwInfra type is %v, no ACI", masterGc.NwInfraType)
		return false, nil
	}

	return true, nil
}
开发者ID:ChengTiesheng,项目名称:netplugin,代码行数:30,代码来源:netmaster.go


示例2: GlobalUpdate

// GlobalUpdate updates global state
func (ac *APIController) GlobalUpdate(global, params *contivModel.Global) error {
	log.Infof("Received GlobalUpdate: %+v. Old: %+v", params, global)

	// Get the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	// Build global config
	gCfg := intent.ConfigGlobal{
		NwInfraType: params.NetworkInfraType,
		VLANs:       params.Vlans,
		VXLANs:      params.Vxlans,
	}

	// Create the object
	err = master.CreateGlobal(stateDriver, &gCfg)
	if err != nil {
		log.Errorf("Error creating global config {%+v}. Err: %v", global, err)
		return err
	}

	global.NetworkInfraType = params.NetworkInfraType
	global.Vlans = params.Vlans
	global.Vxlans = params.Vxlans

	return nil
}
开发者ID:nikolayvoronchikhin,项目名称:netplugin,代码行数:30,代码来源:apiController.go


示例3: FindDocknetByUUID

// FindDocknetByUUID find the docknet by UUID
func FindDocknetByUUID(dnetID string) (*OperState, error) {
	// Get the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		log.Warnf("Couldn't read global config %v", err)
		return nil, err
	}

	tmpDnet := OperState{}
	tmpDnet.StateDriver = stateDriver
	dnetOperList, err := tmpDnet.ReadAll()
	if err != nil {
		log.Errorf("Error getting docknet list. Err: %v", err)
		return nil, err
	}

	// Walk all dnets and find the matching UUID
	for _, dnet := range dnetOperList {
		if dnet.(*OperState).DocknetUUID == dnetID {
			return dnet.(*OperState), nil
		}
	}

	return nil, errors.New("docknet UUID not found")
}
开发者ID:vvb,项目名称:netplugin,代码行数:26,代码来源:docknet.go


示例4: TenantCreate

// TenantCreate creates a tenant
func (ac *APIController) TenantCreate(tenant *contivModel.Tenant) error {
	log.Infof("Received TenantCreate: %+v", tenant)

	if tenant.TenantName == "" {
		return core.Errorf("Invalid tenant name")
	}

	// Get the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	// Build tenant config
	tenantCfg := intent.ConfigTenant{
		Name:           tenant.TenantName,
		DefaultNetwork: tenant.DefaultNetwork,
	}

	// Create the tenant
	err = master.CreateTenant(stateDriver, &tenantCfg)
	if err != nil {
		log.Errorf("Error creating tenant {%+v}. Err: %v", tenant, err)
		return err
	}

	return nil
}
开发者ID:nikolayvoronchikhin,项目名称:netplugin,代码行数:29,代码来源:apiController.go


示例5: NetworkDelete

// NetworkDelete deletes network
func (ac *APIController) NetworkDelete(network *contivModel.Network) error {
	log.Infof("Received NetworkDelete: %+v", network)

	// Find the tenant
	tenant := contivModel.FindTenant(network.TenantName)
	if tenant == nil {
		return core.Errorf("Tenant not found")
	}

	// Remove link
	modeldb.RemoveLinkSet(&tenant.LinkSets.Networks, network)

	// Save the tenant too since we removed the links
	err := tenant.Write()
	if err != nil {
		return err
	}

	// Get the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	// Delete the network
	networkID := network.NetworkName + "." + network.TenantName
	err = master.DeleteNetworkID(stateDriver, networkID)
	if err != nil {
		log.Errorf("Error deleting network %s. Err: %v", network.NetworkName, err)
	}

	return nil
}
开发者ID:nikolayvoronchikhin,项目名称:netplugin,代码行数:34,代码来源:apiController.go


示例6: UpdateEndpointGroup

//UpdateEndpointGroup updates the endpointgroups
func UpdateEndpointGroup(bandwidth, groupName, tenantName string, Dscp, burst int) error {

	// Get the state driver - get the etcd driver state
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	key := mastercfg.GetEndpointGroupKey(groupName, tenantName)
	if key == "" {
		return errors.New("Error finding endpointGroup key ")
	}

	// Read etcd driver
	epCfg := mastercfg.EndpointGroupState{}
	epCfg.StateDriver = stateDriver

	err = epCfg.Read(key)
	if err != nil {
		log.Errorf("Error finding endpointgroup %s. Err: %v", key, err)
		return err
	}

	//update the epGroup state
	epCfg.DSCP = Dscp
	epCfg.Bandwidth = bandwidth
	epCfg.Burst = burst

	//Write to etcd
	err = epCfg.Write()
	if err != nil {
		return err
	}
	return nil
}
开发者ID:abhinandanpb,项目名称:netplugin,代码行数:36,代码来源:endpointGroup.go


示例7: BgpCreate

//BgpCreate add bgp neighbor
func (ac *APIController) BgpCreate(bgpNeighborCfg *contivModel.Bgp) error {
	log.Infof("Received BgpCreate: %+v", bgpNeighborCfg)

	if bgpNeighborCfg.Hostname == "" {
		return core.Errorf("Invalid host name")
	}

	// Get the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	// Build bgp config
	bgpCfg := intent.ConfigBgp{
		Hostname: bgpNeighborCfg.Hostname,
		As:       bgpNeighborCfg.AS,
		Neighbor: bgpNeighborCfg.Neighbor,
	}

	// Add the Bgp neighbor
	err = master.AddBgpNeighbors(stateDriver, &bgpCfg)
	if err != nil {
		log.Errorf("Error creating Bgp neighbor {%+v}. Err: %v", bgpNeighborCfg.Neighbor, err)
		return err
	}
	return nil
}
开发者ID:nikolayvoronchikhin,项目名称:netplugin,代码行数:29,代码来源:apiController.go


示例8: endpoints

// XXX: This function should be returning logical state instead of driver state
func (d *daemon) endpoints(id string) ([]core.State, error) {
	var (
		err error
		ep  *drivers.OvsOperEndpointState
	)

	ep = &drivers.OvsOperEndpointState{}
	if ep.StateDriver, err = utils.GetStateDriver(); err != nil {
		return nil, err
	}

	if id == "all" {
		eps, err := ep.ReadAll()
		if err != nil {
			return []core.State{}, nil
		}
		return eps, nil
	}

	err = ep.Read(id)
	if err == nil {
		return []core.State{core.State(ep)}, nil
	}

	return nil, core.Errorf("Unexpected code path. Recieved error during read: %v", err)
}
开发者ID:ChengTiesheng,项目名称:netplugin,代码行数:27,代码来源:main.go


示例9: ProcessDeletions

// ProcessDeletions deletes the configuration passed from netmaster's statestore.
// This may result in generating Delete triggers for the netplugin.
func ProcessDeletions(allCfg *intent.Config) (err error) {
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	for _, tenant := range allCfg.Tenants {
		err1 := DeleteEndpoints(stateDriver, &tenant)
		if err1 != nil {
			log.Errorf("error deleting endpoints '%s' \n", err1)
			err = err1
			continue
		}

		err1 = DeleteNetworks(stateDriver, &tenant)
		if err1 != nil {
			log.Errorf("error deleting networks '%s' \n", err1)
			err = err1
			continue
		}

		err1 = DeleteTenant(stateDriver, &tenant)
		if err1 != nil {
			log.Errorf("error deleting tenant '%s' \n", err1)
			err = err1
			continue
		}
	}

	return
}
开发者ID:rtrentin73,项目名称:netplugin,代码行数:33,代码来源:cfgutils.go


示例10: ServiceLBDelete

//ServiceLBDelete deletes service object
func (ac *APIController) ServiceLBDelete(serviceCfg *contivModel.ServiceLB) error {

	log.Info("Received Service Load Balancer delete : {%+v}", serviceCfg)

	if serviceCfg.ServiceName == "" {
		return core.Errorf("Invalid service name")
	}
	if serviceCfg.TenantName == "" {
		serviceCfg.TenantName = "default"
	}
	// Get the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	// Add the service object
	err = master.DeleteServiceLB(stateDriver, serviceCfg.ServiceName, serviceCfg.TenantName)
	if err != nil {
		log.Errorf("Error deleting Service Load Balancer object {%+v}. Err: %v", serviceCfg.ServiceName, err)
		return err
	}
	return nil

}
开发者ID:karamsivia,项目名称:netplugin,代码行数:26,代码来源:apiController.go


示例11: ReleaseAddressHandler

// ReleaseAddressHandler releases addresses
func ReleaseAddressHandler(w http.ResponseWriter, r *http.Request, vars map[string]string) (interface{}, error) {
	var relReq AddressReleaseRequest

	// Get object from the request
	err := json.NewDecoder(r.Body).Decode(&relReq)
	if err != nil {
		log.Errorf("Error decoding ReleaseAddressHandler. Err %v", err)
		return nil, err
	}

	log.Infof("Received AddressReleaseRequest: %+v", relReq)

	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return nil, err
	}

	// find the network from network id
	nwCfg := &mastercfg.CfgNetworkState{}
	nwCfg.StateDriver = stateDriver
	err = nwCfg.Read(relReq.NetworkID)
	if err != nil {
		log.Errorf("network %s is not operational", relReq.NetworkID)
		return nil, err
	}

	// release addresses
	err = networkReleaseAddress(nwCfg, relReq.IPv4Address)
	if err != nil {
		log.Errorf("Failed to release address. Err: %v", err)
		return nil, err
	}

	return "success", nil
}
开发者ID:rtrentin73,项目名称:netplugin,代码行数:36,代码来源:api.go


示例12: DeleteEndpointGroup

// DeleteEndpointGroup handles endpoint group deletes
func DeleteEndpointGroup(tenantName, groupName string) error {
	// Get the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	epgKey := mastercfg.GetEndpointGroupKey(groupName, tenantName)
	epgCfg := &mastercfg.EndpointGroupState{}
	epgCfg.StateDriver = stateDriver
	err = epgCfg.Read(epgKey)
	if err != nil {
		log.Errorf("error reading EPG key %s. Error: %s", epgKey, err)
		return err
	}

	if epgCfg.EpCount != 0 {
		return core.Errorf("Error: EPG %s has active endpoints", groupName)
	}

	// Delete the endpoint group state
	gstate.GlobalMutex.Lock()
	defer gstate.GlobalMutex.Unlock()
	gCfg := gstate.Cfg{}
	gCfg.StateDriver = stateDriver
	err = gCfg.Read(epgCfg.TenantName)
	if err != nil {
		log.Errorf("error reading tenant cfg state. Error: %s", err)
		return err
	}

	// if aci mode we allocate per-epg vlan. free it here.
	aciMode, aErr := IsAciConfigured()
	if aErr != nil {
		return aErr
	}

	if aciMode {
		if epgCfg.PktTagType == "vlan" {
			err = gCfg.FreeVLAN(uint(epgCfg.PktTag))
			if err != nil {
				return err
			}
			log.Debugf("Freed vlan %v\n", epgCfg.PktTag)
		}
	}

	// Delete endpoint group
	err = epgCfg.Clear()
	if err != nil {
		log.Errorf("error writing epGroup config. Error: %v", err)
		return err
	}

	if GetClusterMode() == "docker" {
		return docknet.DeleteDockNet(epgCfg.TenantName, epgCfg.NetworkName, epgCfg.GroupName)
	}
	return nil
}
开发者ID:jojimt,项目名称:netplugin,代码行数:60,代码来源:endpointGroup.go


示例13: detachServiceContainer

// detachServiceContainer detaches the service container's endpoint during network delete
//      - detach happens only if all other endpoints in the network are already removed
func detachServiceContainer(tenantName, networkName string) error {
	docker, err := utils.GetDockerClient()
	if err != nil {
		log.Errorf("Unable to connect to docker. Error %v", err)
		return errors.New("Unable to connect to docker")
	}

	dnsContName := getDNSName(tenantName)
	cinfo, err := docker.InspectContainer(dnsContName)
	if err != nil {
		log.Errorf("Error inspecting the container %s. Err: %v", dnsContName, err)
		return err
	}

	// Trim default tenant
	dnetName := docknet.GetDocknetName(tenantName, networkName, "")

	// inspect docker network
	nwState, err := docker.InspectNetwork(dnetName)
	if err != nil {
		log.Errorf("Error while inspecting network: %+v", dnetName)
		return err
	}

	log.Infof("Containers in network: %+v are {%+v}", dnetName, nwState.Containers)
	dnsServerIP := strings.Split(nwState.Containers[cinfo.Id].IPv4Address, "/")[0]

	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		log.Errorf("Could not get StateDriver while trying to disconnect dnsContainer from %+v", networkName)
		return err
	}

	// Read network config and get DNSServer information
	nwCfg := &mastercfg.CfgNetworkState{}
	nwCfg.StateDriver = stateDriver
	networkID := networkName + "." + tenantName
	err = nwCfg.Read(networkID)
	if err != nil {
		return err
	}

	log.Infof("dnsServerIP: %+v, nwCfg.dnsip: %+v", dnsServerIP, nwCfg.DNSServer)
	// Remove dns container from network if all other endpoints are withdrawn
	if len(nwState.Containers) == 1 && (dnsServerIP == nwCfg.DNSServer) {
		log.Infof("Disconnecting dns container from network as all other endpoints are removed: %+v", networkName)
		err = docker.DisconnectNetwork(dnetName, dnsContName, false)
		if err != nil {
			log.Errorf("Could not detach container(%s) from network %s. Error: %s",
				dnsContName, dnetName, err)
			return err
		}
	}

	return nil
}
开发者ID:abhinandanpb,项目名称:netplugin,代码行数:58,代码来源:network.go


示例14: NetworkCreate

// NetworkCreate creates network
func (ac *APIController) NetworkCreate(network *contivModel.Network) error {
	log.Infof("Received NetworkCreate: %+v", network)

	// Make sure tenant exists
	if network.TenantName == "" {
		return core.Errorf("Invalid tenant name")
	}

	tenant := contivModel.FindTenant(network.TenantName)
	if tenant == nil {
		return core.Errorf("Tenant not found")
	}

	// If there is an EndpointGroup with the same name as this network, reject.
	nameClash := contivModel.FindEndpointGroup(network.Key)
	if nameClash != nil {
		return core.Errorf("EndpointGroup %s conflicts with the network name",
			nameClash.GroupName)
	}

	// Get the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	// Build network config
	networkCfg := intent.ConfigNetwork{
		Name:       network.NetworkName,
		NwType:     network.NwType,
		PktTagType: network.Encap,
		PktTag:     network.PktTag,
		SubnetCIDR: network.Subnet,
		Gateway:    network.Gateway,
	}

	// Create the network
	err = master.CreateNetwork(networkCfg, stateDriver, network.TenantName)
	if err != nil {
		log.Errorf("Error creating network {%+v}. Err: %v", network, err)
		return err
	}

	// Setup links
	modeldb.AddLink(&network.Links.Tenant, tenant)
	modeldb.AddLinkSet(&tenant.LinkSets.Networks, network)

	// Save the tenant too since we added the links
	err = tenant.Write()
	if err != nil {
		log.Errorf("Error updating tenant state(%+v). Err: %v", tenant, err)
		return err
	}

	return nil
}
开发者ID:karamsivia,项目名称:netplugin,代码行数:57,代码来源:apiController.go


示例15: DeleteEndpointGroup

// DeleteEndpointGroup handles endpoint group deletes
func DeleteEndpointGroup(epgID int) error {
	// Get the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	epgCfg := &mastercfg.EndpointGroupState{}
	epgCfg.StateDriver = stateDriver
	err = epgCfg.Read(strconv.Itoa(epgID))
	if err != nil {
		log.Errorf("EpGroup %v is not configured", epgID)
		return err
	}

	gCfg := gstate.Cfg{}
	gCfg.StateDriver = stateDriver
	err = gCfg.Read(epgCfg.Tenant)
	if err != nil {
		log.Errorf("error reading tenant cfg state. Error: %s", err)
		return err
	}

	// if aci mode we allocate per-epg vlan. free it here.
	aciMode, aErr := IsAciConfigured()
	if aErr != nil {
		return aErr
	}

	if aciMode {
		tempRm, rErr := resources.GetStateResourceManager()
		if rErr != nil {
			return rErr
		}
		rm := core.ResourceManager(tempRm)
		if epgCfg.PktTagType == "vlan" {
			err = gCfg.FreeVLAN(rm, uint(epgCfg.PktTag))
			if err != nil {
				return err
			}
			log.Debugf("Freed vlan %v\n", epgCfg.PktTag)
		}
	}

	epgNet := epgCfg.Name + "." + epgCfg.NetworkName + "." + epgCfg.Tenant

	err = epgCfg.Clear()
	if err != nil {
		log.Errorf("error writing epGroup config. Error: %v", err)
		return err
	}

	return deleteDockNet(epgNet)
}
开发者ID:ChengTiesheng,项目名称:netplugin,代码行数:55,代码来源:endpointGroup.go


示例16: ServiceLBCreate

//ServiceLBCreate creates service object
func (ac *APIController) ServiceLBCreate(serviceCfg *contivModel.ServiceLB) error {

	log.Infof("Received Service Load Balancer create: %+v", serviceCfg)

	if serviceCfg.ServiceName == "" {
		return core.Errorf("Invalid service name")
	}
	if serviceCfg.TenantName == "" {
		serviceCfg.TenantName = "default"
	}

	if len(serviceCfg.Selectors) == 0 {
		return core.Errorf("Invalid selector options")
	}

	if !validatePorts(serviceCfg.Ports) {
		return core.Errorf("Invalid Port maping . Port format is - Port:TargetPort:Protocol")
	}

	// Get the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	// Build service config
	serviceIntentCfg := intent.ConfigServiceLB{
		ServiceName: serviceCfg.ServiceName,
		Tenant:      serviceCfg.TenantName,
		Network:     serviceCfg.NetworkName,
		IPAddress:   serviceCfg.IpAddress,
	}
	serviceIntentCfg.Ports = append(serviceIntentCfg.Ports, serviceCfg.Ports...)

	serviceIntentCfg.Selectors = make(map[string]string)

	for _, selector := range serviceCfg.Selectors {
		if validateSelectors(selector) {
			key := strings.Split(selector, "=")[0]
			value := strings.Split(selector, "=")[1]
			serviceIntentCfg.Selectors[key] = value
		} else {
			return core.Errorf("Invalid selector %s. selector format is key1=value1", selector)
		}
	}
	// Add the service object
	err = master.CreateServiceLB(stateDriver, &serviceIntentCfg)
	if err != nil {
		log.Errorf("Error creating service  {%+v}. Err: %v", serviceIntentCfg.ServiceName, err)
		return err
	}
	return nil

}
开发者ID:karamsivia,项目名称:netplugin,代码行数:55,代码来源:apiController.go


示例17: CreateAppNw

//CreateAppNw Fill in the Nw spec and launch the nw infra
func CreateAppNw(app *contivModel.AppProfile) error {
	aciPresent, aErr := master.IsAciConfigured()
	if aErr != nil {
		log.Errorf("Couldn't read global config %v", aErr)
		return aErr
	}

	if !aciPresent {
		log.Debugf("ACI not configured")
		return nil
	}

	// Get the state driver
	stateDriver, uErr := utils.GetStateDriver()
	if uErr != nil {
		return uErr
	}

	eMap := &epgMap{}
	eMap.Specs = make(map[string]epgSpec)
	ans := &appNwSpec{}

	ans.TenantName = app.TenantName
	ans.AppName = app.AppProfileName

	// Gather all basic epg info into the epg map
	for epgKey := range app.LinkSets.EndpointGroups {
		epgObj := contivModel.FindEndpointGroup(epgKey)
		if epgObj == nil {
			err := fmt.Sprintf("Epg %v does not exist", epgKey)
			log.Errorf("%v", err)
			return errors.New(err)
		}

		if err := appendEpgInfo(eMap, epgObj, stateDriver); err != nil {
			log.Errorf("Error getting epg info %v", err)
			return err
		}
	}

	// walk the map and add to ANS
	for _, epg := range eMap.Specs {
		ans.Epgs = append(ans.Epgs, epg)
		log.Debugf("Added epg %v", epg.Name)
	}

	log.Infof("Launching appNwSpec: %+v", ans)
	lErr := ans.launch()
	time.Sleep(2 * time.Second)
	ans.notifyDP()

	return lErr
}
开发者ID:abhinandanpb,项目名称:netplugin,代码行数:54,代码来源:infraproxy.go


示例18: NetworkCreate

// NetworkCreate creates network
func (ac *APIController) NetworkCreate(network *contivModel.Network) error {
	log.Infof("Received NetworkCreate: %+v", network)

	// Make sure tenant exists
	if network.TenantName == "" {
		return errors.New("Invalid tenant name")
	}

	tenant := contivModel.FindTenant(network.TenantName)
	if tenant == nil {
		return errors.New("Tenant not found")
	}

	// Setup links
	modeldb.AddLink(&network.Links.Tenant, tenant)
	modeldb.AddLinkSet(&tenant.LinkSets.Networks, network)

	// Save the tenant too since we added the links
	err := tenant.Write()
	if err != nil {
		log.Errorf("Error updating tenant state(%+v). Err: %v", tenant, err)
		return err
	}

	// Get the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	// Build networ config
	networkCfg := intent.ConfigNetwork{
		Name:       network.NetworkName,
		PktTagType: network.Encap,
		PktTag:     "",
		SubnetCIDR: network.Subnet,
		DefaultGw:  network.DefaultGw,
	}

	// Create the network
	err = master.CreateNetwork(networkCfg, stateDriver, network.TenantName)
	if err != nil {
		log.Errorf("Error creating network {%+v}. Err: %v", network, err)
		return err
	}

	return nil
}
开发者ID:balajisiva,项目名称:netplugin,代码行数:49,代码来源:apiController.go


示例19: netdGetEndpoint

// netdGetEndpoint is a utility that reads the EP oper state
func netdGetEndpoint(epID string) (*drivers.OvsOperEndpointState, error) {
	// Get hold of the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return nil, err
	}

	operEp := &drivers.OvsOperEndpointState{}
	operEp.StateDriver = stateDriver
	err = operEp.Read(epID)
	if err != nil {
		return nil, err
	}

	return operEp, nil
}
开发者ID:abhinandanpb,项目名称:netplugin,代码行数:17,代码来源:driver.go


示例20: BgpDelete

//BgpDelete deletes bgp neighbor
func (ac *APIController) BgpDelete(bgpNeighborCfg *contivModel.Bgp) error {

	log.Infof("Received delete for Bgp config on {%+v} ", bgpNeighborCfg.Hostname)
	// Get the state driver
	stateDriver, err := utils.GetStateDriver()
	if err != nil {
		return err
	}

	err = master.DeleteBgpNeighbors(stateDriver, bgpNeighborCfg.Hostname)
	if err != nil {
		log.Errorf("Error Deleting Bgp neighbor. Err: %v", err)
		return err
	}
	return nil
}
开发者ID:nikolayvoronchikhin,项目名称:netplugin,代码行数:17,代码来源:apiController.go



注:本文中的github.com/contiv/netplugin/utils.GetStateDriver函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang utils.NewStateDriver函数代码示例发布时间:2022-05-23
下一篇:
Golang utils.GetDockerClient函数代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap