本文整理汇总了Golang中github.com/contiv/ofnet/rpcHub.Client函数的典型用法代码示例。如果您正苦于以下问题:Golang Client函数的具体用法?Golang Client怎么用?Golang Client使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Client函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: RegisterNode
// RegisterNode registers an agent
func (self *OfnetMaster) RegisterNode(hostInfo *OfnetNode, ret *bool) error {
// Create a node
node := new(OfnetNode)
node.HostAddr = hostInfo.HostAddr
node.HostPort = hostInfo.HostPort
hostKey := fmt.Sprintf("%s:%d", hostInfo.HostAddr, hostInfo.HostPort)
// Add it to DB
self.masterMutex.Lock()
self.agentDb[hostKey] = node
self.masterMutex.Unlock()
log.Infof("Registered node: %+v", node)
// take a read lock for accessing db
self.masterMutex.RLock()
defer self.masterMutex.RUnlock()
// Send all existing endpoints to the new node
for _, endpoint := range self.endpointDb {
if node.HostAddr != endpoint.OriginatorIp.String() {
var resp bool
log.Infof("Sending endpoint: %+v to node %s:%d", endpoint, node.HostAddr, node.HostPort)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("OfnetAgent.EndpointAdd", endpoint, &resp)
if err != nil {
log.Errorf("Error adding endpoint to %s. Err: %v", node.HostAddr, err)
// continue sending other endpoints
}
}
}
// Send all existing policy rules to the new node
for _, rule := range self.policyDb {
var resp bool
log.Infof("Sending rule: %+v to node %s:%d", rule, node.HostAddr, node.HostPort)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("PolicyAgent.AddRule", rule, &resp)
if err != nil {
log.Errorf("Error adding rule to %s. Err: %v", node.HostAddr, err)
// continue sending other rules
}
}
// increment stats
self.incrAgentStats(hostKey, "registered")
return nil
}
开发者ID:jojimt,项目名称:netplugin,代码行数:55,代码来源:ofnetMaster.go
示例2: AddMaster
// Add a master
// ofnet agent tries to connect to the master and download routes
func (self *OfnetAgent) AddMaster(masterInfo *OfnetNode, ret *bool) error {
master := new(OfnetNode)
master.HostAddr = masterInfo.HostAddr
master.HostPort = masterInfo.HostPort
var resp bool
log.Infof("Adding master: %+v", *master)
masterKey := fmt.Sprintf("%s:%d", masterInfo.HostAddr, masterInfo.HostPort)
// Save it in DB
self.masterDb[masterKey] = master
// My info to send to master
myInfo := new(OfnetNode)
myInfo.HostAddr = self.MyAddr
myInfo.HostPort = self.MyPort
// Register the agent with the master
err := rpcHub.Client(master.HostAddr, master.HostPort).Call("OfnetMaster.RegisterNode", &myInfo, &resp)
if err != nil {
log.Fatalf("Failed to register with the master %+v. Err: %v", master, err)
return err
}
// Perform master added callback so that datapaths can send their FDB to master
err = self.datapath.MasterAdded(master)
if err != nil {
log.Errorf("Error making master added callback for %+v. Err: %v", master, err)
}
// Send all local endpoints to new master.
for _, endpoint := range self.localEndpointDb {
if endpoint.OriginatorIp.String() == self.localIp.String() {
var resp bool
log.Infof("Sending endpoint %+v to master %+v", endpoint, master)
// Make the RPC call to add the endpoint to master
client := rpcHub.Client(master.HostAddr, master.HostPort)
err := client.Call("OfnetMaster.EndpointAdd", endpoint, &resp)
if err != nil {
log.Errorf("Failed to add endpoint %+v to master %+v. Err: %v", endpoint, master, err)
return err
}
}
}
return nil
}
开发者ID:balajisiva,项目名称:netplugin,代码行数:53,代码来源:ofnetAgent.go
示例3: AddMaster
// Add a master
// ofnet agent tries to connect to the master and download routes
func (self *OfnetAgent) AddMaster(masterInfo *OfnetNode, ret *bool) error {
master := new(OfnetNode)
master.HostAddr = masterInfo.HostAddr
master.HostPort = masterInfo.HostPort
var resp bool
log.Infof("Adding master: %+v", *master)
masterKey := fmt.Sprintf("%s:%d", masterInfo.HostAddr, masterInfo.HostPort)
// Save it in DB
self.masterDb[masterKey] = master
// My info to send to master
myInfo := new(OfnetNode)
myInfo.HostAddr = self.MyAddr
myInfo.HostPort = self.MyPort
// Register the agent with the master
err := rpcHub.Client(master.HostAddr, master.HostPort).Call("OfnetMaster.RegisterNode", &myInfo, &resp)
if err != nil {
log.Fatalf("Failed to register with the master %+v. Err: %v", master, err)
return err
}
// Perform master added callback so that datapaths can send their FDB to master
err = self.datapath.MasterAdded(master)
if err != nil {
log.Errorf("Error making master added callback for %+v. Err: %v", master, err)
}
return nil
}
开发者ID:shwethab,项目名称:netplugin,代码行数:36,代码来源:ofnetAgent.go
示例4: AddRule
// AddRule adds a new rule to the policyDB
func (self *OfnetMaster) AddRule(rule *OfnetPolicyRule) error {
// Check if we have the rule already
if self.policyDb[rule.RuleId] != nil {
return errors.New("Rule already exists")
}
// Save the rule in DB
self.policyDb[rule.RuleId] = rule
// Publish it to all agents except where it came from
for _, node := range self.agentDb {
var resp bool
log.Infof("Sending rule: %+v to node %s:%d", rule, node.HostAddr, node.HostPort)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("PolicyAgent.AddRule", rule, &resp)
if err != nil {
log.Errorf("Error adding rule to %s. Err: %v", node.HostAddr, err)
return err
}
}
return nil
}
开发者ID:ChengTiesheng,项目名称:netplugin,代码行数:26,代码来源:ofnetMaster.go
示例5: MacRouteAdd
// Add a mac route
func (self *OfnetMaster) MacRouteAdd(macRoute *MacRoute, ret *bool) error {
// Check if we have the route already and which is more recent
oldRoute := self.macRouteDb[macRoute.MacAddrStr]
if oldRoute != nil {
// If old route has more recent timestamp, nothing to do
if !macRoute.Timestamp.After(oldRoute.Timestamp) {
return nil
}
}
// Save the route in DB
self.macRouteDb[macRoute.MacAddrStr] = macRoute
// Publish it to all agents except where it came from
for _, node := range self.agentDb {
if node.HostAddr != macRoute.OriginatorIp.String() {
var resp bool
log.Infof("Sending MacRoute: %+v to node %s", macRoute, node.HostAddr)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("Vxlan.MacRouteAdd", macRoute, &resp)
if err != nil {
log.Errorf("Error adding route to %s. Err: %v", node.HostAddr, err)
return err
}
}
}
*ret = true
return nil
}
开发者ID:shwethab,项目名称:netplugin,代码行数:33,代码来源:ofnetMaster.go
示例6: EndpointDel
// Delete an Endpoint
func (self *OfnetMaster) EndpointDel(ep *OfnetEndpoint, ret *bool) error {
// Check if we have the endpoint, if we dont have the endpoint, nothing to do
oldEp := self.endpointDb[ep.EndpointID]
if oldEp == nil {
return nil
}
// If existing endpoint has more recent timestamp, nothing to do
if oldEp.Timestamp.After(ep.Timestamp) {
return nil
}
// Delete the endpoint from DB
delete(self.endpointDb, ep.EndpointID)
// Publish it to all agents except where it came from
for _, node := range self.agentDb {
if node.HostAddr != ep.OriginatorIp.String() {
var resp bool
log.Infof("Sending DELETE endpoint: %+v to node %s:%d", ep, node.HostAddr, node.HostPort)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("OfnetAgent.EndpointDel", ep, &resp)
if err != nil {
log.Errorf("Error sending DELERE endpoint to %s. Err: %v", node.HostAddr, err)
return err
}
}
}
*ret = true
return nil
}
开发者ID:ChengTiesheng,项目名称:netplugin,代码行数:35,代码来源:ofnetMaster.go
示例7: DelRule
// DelRule removes a rule from policy DB
func (self *OfnetMaster) DelRule(rule *OfnetPolicyRule) error {
// Check if we have the rule
if self.policyDb[rule.RuleId] == nil {
return errors.New("Rule does not exist")
}
// Remove the rule from DB
delete(self.policyDb, rule.RuleId)
// Publish it to all agents except where it came from
for _, node := range self.agentDb {
var resp bool
log.Infof("Sending DELETE rule: %+v to node %s", rule, node.HostAddr)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("PolicyAgent.DelRule", rule, &resp)
if err != nil {
log.Errorf("Error adding rule to %s. Err: %v", node.HostAddr, err)
return err
}
}
return nil
}
开发者ID:ChengTiesheng,项目名称:netplugin,代码行数:26,代码来源:ofnetMaster.go
示例8: RemoveLocalEndpoint
// Remove local endpoint
func (self *OfnetAgent) RemoveLocalEndpoint(portNo uint32) error {
// Clear it from DB
delete(self.portVlanMap, portNo)
epreg := self.localEndpointDb[portNo]
if epreg == nil {
log.Errorf("Endpoint not found for port %d", portNo)
return errors.New("Endpoint not found")
}
// Call the datapath
err := self.datapath.RemoveLocalEndpoint(*epreg)
if err != nil {
log.Errorf("Error deleting endpointon port %d. Err: %v", portNo, err)
}
// delete the endpoint from local endpoint table
delete(self.endpointDb, epreg.EndpointID)
// Send the DELETE to all known masters
for _, master := range self.masterDb {
var resp bool
log.Infof("Sending DELETE endpoint %+v to master %+v", epreg, master)
// Make the RPC call to delete the endpoint on master
client := rpcHub.Client(master.HostAddr, master.HostPort)
err := client.Call("OfnetMaster.EndpointDel", epreg, &resp)
if err != nil {
log.Errorf("Failed to DELETE endpoint %+v on master %+v. Err: %v", epreg, master, err)
}
}
return nil
}
开发者ID:balajisiva,项目名称:netplugin,代码行数:36,代码来源:ofnetAgent.go
示例9: EndpointAdd
// Add an Endpoint
func (self *OfnetMaster) EndpointAdd(ep *OfnetEndpoint, ret *bool) error {
// Check if we have the endpoint already and which is more recent
oldEp := self.endpointDb[ep.EndpointID]
if oldEp != nil {
// If old endpoint has more recent timestamp, nothing to do
if !ep.Timestamp.After(oldEp.Timestamp) {
return nil
}
}
// Save the endpoint in DB
self.endpointDb[ep.EndpointID] = ep
// Publish it to all agents except where it came from
for _, node := range self.agentDb {
if node.HostAddr != ep.OriginatorIp.String() {
var resp bool
log.Infof("Sending endpoint: %+v to node %s:%d", ep, node.HostAddr, node.HostPort)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("OfnetAgent.EndpointAdd", ep, &resp)
if err != nil {
log.Errorf("Error adding endpoint to %s. Err: %v", node.HostAddr, err)
return err
}
}
}
*ret = true
return nil
}
开发者ID:ChengTiesheng,项目名称:netplugin,代码行数:33,代码来源:ofnetMaster.go
示例10: MacRouteDel
// Delete a mac route
func (self *OfnetMaster) MacRouteDel(macRoute *MacRoute, ret *bool) error {
// Check if we have the route, if we dont have the route, nothing to do
oldRoute := self.macRouteDb[macRoute.MacAddrStr]
if oldRoute == nil {
return nil
}
// If existing route has more recent timestamp, nothing to do
if oldRoute.Timestamp.After(macRoute.Timestamp) {
return nil
}
// Delete the route from DB
delete(self.macRouteDb, macRoute.MacAddrStr)
// Publish it to all agents except where it came from
for _, node := range self.agentDb {
if node.HostAddr != macRoute.OriginatorIp.String() {
var resp bool
log.Infof("Sending DELETE MacRoute: %+v to node %s", macRoute, node.HostAddr)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("Vxlan.MacRouteDel", macRoute, &resp)
if err != nil {
log.Errorf("Error sending DELERE mac route to %s. Err: %v", node.HostAddr, err)
return err
}
}
}
*ret = true
return nil
}
开发者ID:shwethab,项目名称:netplugin,代码行数:35,代码来源:ofnetMaster.go
示例11: RegisterNode
// Register an agent
func (self *OfnetMaster) RegisterNode(hostInfo *OfnetNode, ret *bool) error {
// Create a node
node := new(OfnetNode)
node.HostAddr = hostInfo.HostAddr
node.HostPort = hostInfo.HostPort
hostKey := fmt.Sprintf("%s:%d", hostInfo.HostAddr, hostInfo.HostPort)
// Add it to DB
self.agentDb[hostKey] = node
log.Infof("Registered node: %+v", node)
// Send all existing routes
for _, route := range self.routeDb {
if node.HostAddr != route.OriginatorIp.String() {
var resp bool
log.Infof("Sending Route: %+v to node %s", route, node.HostAddr)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("Vrouter.RouteAdd", route, &resp)
if err != nil {
log.Errorf("Error adding route to %s. Err: %v", node.HostAddr, err)
}
}
}
// Send all mac routes
for _, macRoute := range self.macRouteDb {
if node.HostAddr != macRoute.OriginatorIp.String() {
var resp bool
log.Infof("Sending MacRoute: %+v to node %s", macRoute, node.HostAddr)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("Vxlan.MacRouteAdd", macRoute, &resp)
if err != nil {
log.Errorf("Error adding route to %s. Err: %v", node.HostAddr, err)
}
}
}
return nil
}
开发者ID:shwethab,项目名称:netplugin,代码行数:46,代码来源:ofnetMaster.go
示例12: RegisterNode
// Register an agent
func (self *OfnetMaster) RegisterNode(hostInfo *OfnetNode, ret *bool) error {
// Create a node
node := new(OfnetNode)
node.HostAddr = hostInfo.HostAddr
node.HostPort = hostInfo.HostPort
hostKey := fmt.Sprintf("%s:%d", hostInfo.HostAddr, hostInfo.HostPort)
// Add it to DB
self.agentDb[hostKey] = node
log.Infof("Registered node: %+v", node)
// Send all existing endpoints to the new node
for _, endpoint := range self.endpointDb {
if node.HostAddr != endpoint.OriginatorIp.String() {
var resp bool
log.Infof("Sending endpoint: %+v to node %s:%d", endpoint, node.HostAddr, node.HostPort)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("OfnetAgent.EndpointAdd", endpoint, &resp)
if err != nil {
log.Errorf("Error adding endpoint to %s. Err: %v", node.HostAddr, err)
}
}
}
// Send all existing policy rules to the new node
for _, rule := range self.policyDb {
var resp bool
log.Infof("Sending rule: %+v to node %s:%d", rule, node.HostAddr, node.HostPort)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("PolicyAgent.AddRule", rule, &resp)
if err != nil {
log.Errorf("Error adding rule to %s. Err: %v", node.HostAddr, err)
return err
}
}
return nil
}
开发者ID:ChengTiesheng,项目名称:netplugin,代码行数:45,代码来源:ofnetMaster.go
示例13: AddLocalEndpoint
// Add a local endpoint.
// This takes ofp port number, mac address, vlan and IP address of the port.
func (self *OfnetAgent) AddLocalEndpoint(endpoint EndpointInfo) error {
// Add port vlan mapping
self.portVlanMap[endpoint.PortNo] = &endpoint.Vlan
// Map Vlan to VNI
vni := self.vlanVniMap[endpoint.Vlan]
if vni == nil {
log.Errorf("VNI for vlan %d is not known", endpoint.Vlan)
return errors.New("Unknown Vlan")
}
epId := self.getEndpointId(endpoint)
// Build endpoint registry info
epreg := &OfnetEndpoint{
EndpointID: epId,
EndpointType: "internal",
EndpointGroup: endpoint.EndpointGroup,
IpAddr: endpoint.IpAddr,
VrfId: 0, // FIXME set VRF correctly
MacAddrStr: endpoint.MacAddr.String(),
Vlan: endpoint.Vlan,
Vni: *vni,
OriginatorIp: self.localIp,
PortNo: endpoint.PortNo,
Timestamp: time.Now(),
}
// Call the datapath
err := self.datapath.AddLocalEndpoint(*epreg)
if err != nil {
log.Errorf("Adding endpoint (%+v) to datapath. Err: %v", epreg, err)
return err
}
// Add the endpoint to local routing table
self.endpointDb[epId] = epreg
self.localEndpointDb[endpoint.PortNo] = epreg
// Send the endpoint to all known masters
for _, master := range self.masterDb {
var resp bool
log.Infof("Sending endpoint %+v to master %+v", epreg, master)
// Make the RPC call to add the endpoint to master
err := rpcHub.Client(master.HostAddr, master.HostPort).Call("OfnetMaster.EndpointAdd", epreg, &resp)
if err != nil {
log.Errorf("Failed to add endpoint %+v to master %+v. Err: %v", epreg, master, err)
return err
}
}
return nil
}
开发者ID:rtrentin73,项目名称:netplugin,代码行数:57,代码来源:ofnetAgent.go
示例14: EndpointDel
// Delete an Endpoint
func (self *OfnetMaster) EndpointDel(ep *OfnetEndpoint, ret *bool) error {
// Check if we have the endpoint, if we dont have the endpoint, nothing to do
self.masterMutex.RLock()
oldEp := self.endpointDb[ep.EndpointID]
self.masterMutex.RUnlock()
if oldEp == nil {
log.Errorf("Received endpoint DELETE on a non existing endpoint %+v", ep)
return nil
}
// If existing endpoint has more recent timestamp, nothing to do
if oldEp.Timestamp.After(ep.Timestamp) {
return nil
}
// Delete the endpoint from DB
self.masterMutex.Lock()
delete(self.endpointDb, ep.EndpointID)
self.masterMutex.Unlock()
// take a read lock for accessing db
self.masterMutex.RLock()
defer self.masterMutex.RUnlock()
// Publish it to all agents except where it came from
for nodeKey, node := range self.agentDb {
if node.HostAddr != ep.OriginatorIp.String() {
var resp bool
log.Infof("Sending DELETE endpoint: %+v to node %s:%d", ep, node.HostAddr, node.HostPort)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("OfnetAgent.EndpointDel", ep, &resp)
if err != nil {
log.Errorf("Error sending DELERE endpoint to %s. Err: %v", node.HostAddr, err)
// Continue sending the message to other nodes
// increment stats
self.incrAgentStats(nodeKey, "EndpointDelFailure")
} else {
// increment stats
self.incrAgentStats(nodeKey, "EndpointDelSent")
}
}
}
*ret = true
return nil
}
开发者ID:jojimt,项目名称:netplugin,代码行数:50,代码来源:ofnetMaster.go
示例15: EndpointAdd
// Add an Endpoint
func (self *OfnetMaster) EndpointAdd(ep *OfnetEndpoint, ret *bool) error {
log.Infof("Received Endpoint CReate from Remote netplugin")
// Check if we have the endpoint already and which is more recent
self.masterMutex.RLock()
oldEp := self.endpointDb[ep.EndpointID]
self.masterMutex.RUnlock()
if oldEp != nil {
// If old endpoint has more recent timestamp, nothing to do
if !ep.Timestamp.After(oldEp.Timestamp) {
return nil
}
}
// Save the endpoint in DB
self.masterMutex.Lock()
self.endpointDb[ep.EndpointID] = ep
self.masterMutex.Unlock()
// take a read lock for accessing db
self.masterMutex.RLock()
defer self.masterMutex.RUnlock()
// Publish it to all agents except where it came from
for nodeKey, node := range self.agentDb {
if node.HostAddr != ep.OriginatorIp.String() {
var resp bool
log.Infof("Sending endpoint: %+v to node %s:%d", ep, node.HostAddr, node.HostPort)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("OfnetAgent.EndpointAdd", ep, &resp)
if err != nil {
log.Errorf("Error adding endpoint to %s. Err: %v", node.HostAddr, err)
// Continue sending the message to other nodes
// increment stats
self.incrAgentStats(nodeKey, "EndpointAddFailure")
} else {
// increment stats
self.incrAgentStats(nodeKey, "EndpointAddSent")
}
}
}
*ret = true
return nil
}
开发者ID:jojimt,项目名称:netplugin,代码行数:49,代码来源:ofnetMaster.go
示例16: RemoveLocalEndpoint
// Remove local endpoint
func (self *OfnetAgent) RemoveLocalEndpoint(portNo uint32) error {
// increment stats
self.incrStats("RemoveLocalEndpoint")
// find the local copy
epreg, _ := self.localEndpointDb.Get(string(portNo))
if epreg == nil {
log.Errorf("Endpoint not found for port %d", portNo)
return errors.New("Endpoint not found")
}
ep := epreg.(*OfnetEndpoint)
log.Infof("Received local endpoint remove and withdraw for {%+v}", epreg)
// Call the datapath
err := self.datapath.RemoveLocalEndpoint(*ep)
if err != nil {
log.Errorf("Error deleting endpoint port %d. Err: %v", portNo, err)
}
// delete the endpoint from local endpoint table
self.endpointDb.Remove(ep.EndpointID)
self.localEndpointDb.Remove(string(portNo))
self.portVlanMapMutex.Lock()
delete(self.portVlanMap, portNo)
self.portVlanMapMutex.Unlock()
// Send the DELETE to all known masters
self.masterDbMutex.Lock()
for _, master := range self.masterDb {
var resp bool
log.Infof("Sending DELETE endpoint %+v to master %+v", ep, master)
// Make the RPC call to delete the endpoint on master
client := rpcHub.Client(master.HostAddr, master.HostPort)
err := client.Call("OfnetMaster.EndpointDel", ep, &resp)
if err != nil {
log.Errorf("Failed to DELETE endpoint %+v on master %+v. Err: %v", epreg, master, err)
} else {
// increment stats
self.incrStats("EndpointDelSent")
}
}
self.masterDbMutex.Unlock()
log.Infof("Local endpoint removed and withdrawn successfully")
return nil
}
开发者ID:abhinandanpb,项目名称:ofnet,代码行数:48,代码来源:ofnetAgent.go
示例17: AddNode
// AddNode adds a node by calling MasterAdd rpc call on the node
func (self *OfnetMaster) AddNode(hostInfo OfnetNode) error {
var resp bool
// my info
myInfo := new(OfnetNode)
myInfo.HostAddr = self.myAddr
myInfo.HostPort = self.myPort
client := rpcHub.Client(hostInfo.HostAddr, hostInfo.HostPort)
err := client.Call("OfnetAgent.AddMaster", myInfo, &resp)
if err != nil {
log.Errorf("Error calling AddMaster rpc call on node %v. Err: %v", hostInfo, err)
return err
}
return nil
}
开发者ID:jojimt,项目名称:netplugin,代码行数:18,代码来源:ofnetMaster.go
示例18: DetachPolicy
// DetachPolicy deletes policy info from policyDB - SRTE
func (self *OfnetMaster) DetachPolicy(epgPolicyKey string) error {
for _, node := range self.agentDb {
var resp bool
log.Infof("Sending detach policy: to node %s:%d", node.HostAddr, node.HostPort)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("PolicyAgent.DetachPolicy", epgPolicyKey, &resp)
if err != nil {
log.Errorf("Error detaching policy to %s. Err: %v", node.HostAddr, err)
return err
}
}
return nil
}
开发者ID:karamsivia,项目名称:netplugin,代码行数:18,代码来源:ofnetMaster.go
示例19: MakeDummyRpcCall
// Make a dummy RPC call to all agents. for testing purposes..
func (self *OfnetMaster) MakeDummyRpcCall() error {
// Call all agents
for _, node := range self.agentDb {
var resp bool
dummyArg := "dummy string"
log.Infof("Making dummy rpc call to node %+v", node)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("OfnetAgent.DummyRpc", &dummyArg, &resp)
if err != nil {
log.Errorf("Error making dummy rpc call to %+v. Err: %v", node, err)
// Continue sending the message to other nodes
}
}
return nil
}
开发者ID:jojimt,项目名称:netplugin,代码行数:19,代码来源:ofnetMaster.go
示例20: MakeDummyRpcCall
// Make a dummy RPC call to all agents. for testing purposes..
func (self *OfnetMaster) MakeDummyRpcCall() error {
// Publish it to all agents except where it came from
for _, node := range self.agentDb {
var resp bool
dummyArg := "dummy string"
log.Infof("Making dummy rpc call to node %+v", node)
client := rpcHub.Client(node.HostAddr, node.HostPort)
err := client.Call("OfnetAgent.DummyRpc", &dummyArg, &resp)
if err != nil {
log.Errorf("Error making dummy rpc call to %+v. Err: %v", node, err)
return err
}
}
return nil
}
开发者ID:ChengTiesheng,项目名称:netplugin,代码行数:19,代码来源:ofnetMaster.go
注:本文中的github.com/contiv/ofnet/rpcHub.Client函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论