-
Notifications
You must be signed in to change notification settings - Fork 515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Staskraev/l3 agent scheduler #2501
Changes from 2 commits
3226660
effefce
a795059
c5d5056
1a3982f
904e42c
918cd83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -126,6 +126,37 @@ Example to list dragents hosting specific bgp speaker | |||||
for _, a := range allAgents { | ||||||
log.Printf("%+v", a) | ||||||
} | ||||||
|
||||||
Example to list routers scheduled to L3 agent | ||||||
|
||||||
routers, err := agents.ListL3Routers(neutron, "655967f5-d6f3-4732-88f5-617b0ff5c356").Extract() | ||||||
if err != nil { | ||||||
log.Panic(err) | ||||||
} | ||||||
|
||||||
for _, r := range routers { | ||||||
log.Printf("%+v", r) | ||||||
} | ||||||
|
||||||
Example to remove router from L3 agent | ||||||
|
||||||
agentID := "0e1095ae-6f36-40f3-8322-8e1c9a5e68ca" | ||||||
routerID := "e6fa0457-efc2-491d-ac12-17ab60417efd" | ||||||
err = agents.RemoveL3Router(neutron, "0e1095ae-6f36-40f3-8322-8e1c9a5e68ca", "e6fa0457-efc2-491d-ac12-17ab60417efd").ExtractErr() | ||||||
if err != nil { | ||||||
log.Panic(err) | ||||||
} | ||||||
|
||||||
Example to schedule router to L3 agent | ||||||
|
||||||
agentID := "0e1095ae-6f36-40f3-8322-8e1c9a5e68ca" | ||||||
routerID := "e6fa0457-efc2-491d-ac12-17ab60417efd" | ||||||
err = agents.ScheduleL3Router(neutron, agentID, agents.ScheduleL3RouterOpts{routerID}).ExtractErr() | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to be explicit:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right |
||||||
if err != nil { | ||||||
log.Panic(err) | ||||||
} | ||||||
|
||||||
|
||||||
*/ | ||||||
|
||||||
package agents |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import "github.com/gophercloud/gophercloud" | |
|
||
const resourcePath = "agents" | ||
const dhcpNetworksResourcePath = "dhcp-networks" | ||
const l3RoutersResourcePath = "l3-routers" | ||
const bgpSpeakersResourcePath = "bgp-drinstances" | ||
const bgpDRAgentSpeakersResourcePath = "bgp-speakers" | ||
const bgpDRAgentAgentResourcePath = "bgp-dragents" | ||
|
@@ -36,18 +37,36 @@ func dhcpNetworksURL(c *gophercloud.ServiceClient, id string) string { | |
return c.ServiceURL(resourcePath, id, dhcpNetworksResourcePath) | ||
} | ||
|
||
func l3RoutersURL(c *gophercloud.ServiceClient, id string) string { | ||
return c.ServiceURL(resourcePath, id, l3RoutersResourcePath) | ||
} | ||
|
||
func listDHCPNetworksURL(c *gophercloud.ServiceClient, id string) string { | ||
return dhcpNetworksURL(c, id) | ||
} | ||
|
||
func listL3RoutersURL(c *gophercloud.ServiceClient, id string) string { | ||
// TODO | ||
// hmm list should be the plain l3RoutersURL but dhcp example tell otherwise | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leftover comment? Both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. leftover from original research |
||
return l3RoutersURL(c, id) | ||
} | ||
|
||
func scheduleDHCPNetworkURL(c *gophercloud.ServiceClient, id string) string { | ||
return dhcpNetworksURL(c, id) | ||
} | ||
|
||
func scheduleL3RouterURL(c *gophercloud.ServiceClient, id string) string { | ||
return l3RoutersURL(c, id) | ||
} | ||
|
||
func removeDHCPNetworkURL(c *gophercloud.ServiceClient, id string, networkID string) string { | ||
return c.ServiceURL(resourcePath, id, dhcpNetworksResourcePath, networkID) | ||
} | ||
|
||
func removeL3RouterURL(c *gophercloud.ServiceClient, id string, routerID string) string { | ||
return c.ServiceURL(resourcePath, id, l3RoutersResourcePath, routerID) | ||
} | ||
|
||
// return /v2.0/agents/{agent-id}/bgp-drinstances | ||
func listBGPSpeakersURL(c *gophercloud.ServiceClient, agentID string) string { | ||
return c.ServiceURL(resourcePath, agentID, bgpSpeakersResourcePath) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was the intention of defining the
agentID
androuterID
variables to use them here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, thanks