Skip to content
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

Controllers management #93

Open
wants to merge 20 commits into
base: integration-0.8
Choose a base branch
from

Conversation

vicalro
Copy link
Contributor

@vicalro vicalro commented Jul 28, 2015

This PR adds the features of adding, removing and listing controllers to LSIs trough the REST plugin.
Examples on how to use it can be found in the xcli tool.

In order to use the list feature, the API of rofl-common needs to be extended. You may find an extension in vicalro/rofl-common@3d251d6 (branch list_controllers)

@msune msune added this to the v0.8.0 milestone Jul 28, 2015
@msune
Copy link
Contributor

msune commented Jul 29, 2015

List controllers and show controller info should not need -m option:

xcli(local)>show lsi dp0 controllers
ERROR(401): HTTP/GET 'http://127.0.0.1:5757/info/lsi/dp0/controllers'
Unauthorised; is mgmt support enabled (-m)?

xcli(local)>show lsi dp0 controller 0
ERROR(401): HTTP/GET 'http://127.0.0.1:5757/info/lsi/dp0/controller/0'
Unauthorised; is mgmt support enabled (-m)?

xcli(local)>

@msune
Copy link
Contributor

msune commented Jul 29, 2015

xcli(local)>show lsi dp0 controller 0
{
    "Controller" : {
        "id" : 0,
        "channel-status" : "not-established",
        "mode" : "equal",
        "connections" : {
            "0" : {
                "protocol-type" : "plain",
                "ip" : "127.0.0.1",
                "port" : 6653
            }
        }
    }
}

xcli(local)>

"Controller" -> "controller"

And:

xcli(local)>exec add controller dp0 tcp:192.168.1.1:6633
{                                                        
    "assigned id" : 1                                    
}

I think for consistency (list controllers) should be:

xcli(local)>exec add controller dp0 tcp:192.168.1.1:6633
{                                                        
    "controller-id" : 1
}

@msune
Copy link
Contributor

msune commented Jul 29, 2015

Exec with bad parameters dos not send an HTTP 500 error, although it fails to add it:

xcli(local)>exec add controller dp0 tcp:192.168.1.1::6633

xcli(local)>show lsi dp0 controllers
{
    "controller-ids" : [
    ]
}

xcli(local)>exec add controller dp0 tcp192.168.1.1::6633

xcli(local)>show lsi dp0 controllers 
{
    "controller-ids" : [
    ]
}

xcli(local)>exec add controller dp0 tcp45654654192.168.1.1::6633

xcli(local)>show lsi dp0 controllers
{
    "controller-ids" : [
    ]
}

@msune
Copy link
Contributor

msune commented Jul 29, 2015

New APIs are not listed in the index (GET to root):

e.g. http://10.0.0.2:5757/

json_spirit::Object table;

//Perform security checks
if(!authorised(req,rep)) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space. Authorisization here is not needed

std::string lsi_name = std::string(grps[1]);

//Check if LSI exists;
if(!switch_manager::exists_by_name(lsi_name)){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space

- List and show controllers don't require authorized access
- Fixed return message after adding a new controller
- Capturing exception when parsing the parameters of the new controller in xcli
- New APIs listed in the index
@vicalro
Copy link
Contributor Author

vicalro commented Jul 29, 2015

Thanks for the comments. Issues fixed. Check it out!

@msune
Copy link
Contributor

msune commented Jul 29, 2015

ACK. But we need to merge the list_controllers into rofl-common, but first bisdn/rofl-common#17 needs to be fixed, since the commit needs to go on top of integration-0.6 as agreed.

Holding it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants