← Back to team overview

openstack team mailing list archive

Re: creating a security group curling nova v1.1 api

 

Please try
curl -X POST -d ‘{"security_group_rule": {"ip_protocol": "tcp", "from_port": "22", "to_port": "22", "group_id": 67, "parent_group_id": 16, "cidr": "0.0.0.0/0<http://0.0.0.0/0>"}}’ "http://172.16.159.5:8774/v1.1/5/os-security-group-rules";<http://172.16.159.5:8774/v1.1/5/os-security-group-rules> -H "X-Auth-Token: 3dd60c26-5f1d-438a-9e26-a2ff86570196"

That worked for me


./Satya

There are two kind of people in this world, one who understand binary and other who don’t…
&&
There is only two ways to write a error free program, only third one works ☺

From: openstack-bounces+satya.routray=hp.com@xxxxxxxxxxxxxxxxxxx [mailto:openstack-bounces+satya.routray=hp.com@xxxxxxxxxxxxxxxxxxx] On Behalf Of Jay Pipes
Sent: Tuesday, January 10, 2012 10:07 PM
To: Alejandro Comisario
Cc: openstack@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Openstack] creating a security group curling nova v1.1 api

Check what is being sent by using the -v option. Perhaps the JSON you are trying to send isn't going through properly?

Cheers,
-jay
On Tue, Jan 10, 2012 at 10:51 AM, Alejandro Comisario <alejandro.comisario@xxxxxxxxxxxxxxxx<mailto:alejandro.comisario@xxxxxxxxxxxxxxxx>> wrote:
Hi guys, we have a diablo cluster with keystone.
We can successfully create servers, but when we try to add a rule to the default security group, or create a new one, we get a 400 "badRequest" error.

Here we left the two requests, can anyone point where the solution might be ?

LISTING THE DEFAULT SECURITY GROUP:
# curl -X GET "http://172.16.159.5:8774/v1.1/5/os-security-groups";<http://172.16.159.5:8774/v1.1/5/os-security-groups> -H "X-Auth-Token: 3dd60c26-5f1d-438a-9e26-a2ff86570196" | python -mjson.tool
RESP:
{
    "security_groups": [
        {
            "description": "default",
            "id": 67,
            "name": "default",
            "rules": [],
            "tenant_id": "5"
        }
    ]
}

TRYING TO CREATE A SECURITY GROUP:
# curl -X POST -d "{"security_group": {"name": "testSG", "description": "testSG"}}" "http://172.16.x.y:8774/v1.1/5/os-security-groups";<http://172.16.x.y:8774/v1.1/5/os-security-groups> -H "X-Auth-Token: 3dd60c26-5f1d-438a-9e26-a2ff86570196"
RESP :
{"badRequest": {"message": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "code": 400}}

TRYING TO ADD A RULE TO THE DEFAULT SECURITY GROUP:
# curl -X POST -d "{"security_group_rule": {"ip_protocol": "tcp", "from_port": "22", "to_port": "22", "group_id": 67, "parent_group_id": 16, "cidr": "0.0.0.0/0<http://0.0.0.0/0>"}}" "http://172.16.159.5:8774/v1.1/5/os-security-group-rules";<http://172.16.159.5:8774/v1.1/5/os-security-group-rules> -H "X-Auth-Token: 3dd60c26-5f1d-438a-9e26-a2ff86570196"
RESP:
{"badRequest": {"message": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "code": 400}}

PS: the token is the one obtained from keystone for tenant 5, listing of SG is working ok, but creation of new SG nor adding a new rule for that SG, is not.
PS1: Is the parent_group_id value, the same as group_id on the "security_groups" database table ?

Best regards.
--
Error! Filename not specified.<http://www.mercadolibre.com>
Alejandro Comisario
Infrastructure IT - #melicloud Cloud Builder
Arias 3751, Piso 7 (C1430CRG)
Ciudad de Buenos Aires - Argentina
Cel: +549(11) 15-3770-1857
Tel : +54(11) 4640-8443<tel:%2B54%2811%29%204640-8443>

_______________________________________________
Mailing list: https://launchpad.net/~openstack<https://launchpad.net/%7Eopenstack>
Post to     : openstack@xxxxxxxxxxxxxxxxxxx<mailto:openstack@xxxxxxxxxxxxxxxxxxx>
Unsubscribe : https://launchpad.net/~openstack<https://launchpad.net/%7Eopenstack>
More help   : https://help.launchpad.net/ListHelp


References