Skip to content

Conversation

rlrossiter
Copy link

This change adds security groups CLIs. It also adds helpers for manipulating security groups to the network manager. Security groups can be added to a VSI at order time, so public and private security groups were added to the ordering helper.

Ryan Rossiter added 12 commits July 28, 2017 09:55
This adds security group API helpers to the network manager. This allows
users to perform CRUD operations on security groups, security group
rules, and interface attachments to security groups. CLI commands were
also added to perform these API operations on the command line.

Arguments were also added to the instance creation to allow VSIs to be
booted with security groups on the public and/or private interfaces of
the newly created VSI.

Security group information was added to the VSI detail CLI, so the
security groups attached to the interfaces of a VSI are output as part
of the detail.
In order to list the security groups attached to a VSI, we need to add
security groups to the get_instance mask. This is retrieved via
networkComponents[securityGroupBindings[securityGroups]].
When VSIs are not available to view because of permissions, we need to
block them out of the CLI when doing a detail or interface-list.
The mask in the get_securitygroup() function in the manager was wrong,
so fixing that allows the remoteGroupId to print in securitygroup
detail.
Because some of the .get() calls return an empty string, they're not
actually getting filled with formatting.blank(). This changes the get()
calls to add the or after the get() call. This way, if the returned
value is empty string (so not set), we'll fill it with a
formatting.blank() instead of filling it with nothing.
Being consistent is a good thing.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 84.34% when pulling a7d8aba on rlrossiter:security-groups into a7cb4dd on softlayer:master.

@allmightyspiff
Copy link
Member

This looks good to me so far, although I'll want to test it locally myself before merging.
Is this ready to merge or are you still working on it?

@allmightyspiff allmightyspiff self-assigned this Aug 3, 2017
@rlrossiter
Copy link
Author

If you try it out, take a look, and find nothing wrong with it, it's ready to merge. I have no further changes I'm looking to make on it.

@allmightyspiff
Copy link
Member

since this looks to still be in beta I think I will hold off on merging until its released officially for everyone. Otherwise the change looks good and works for me.

Change Log

  • Added sg / securitygroup command
Usage: slcli sg [OPTIONS] COMMAND [ARGS]...

  Network security groups.

Options:
  -h, --help  Show this message and exit.

Commands:
  create            Create a security group.
  delete            Deletes the given security group
  detail            Get details about a security group.
  edit              Edit details of a security group.
  interface-add     Attach an interface to a security group.
  interface-list    List interfaces associated with security...
  interface-remove  Detach an interface from a security group.
  list              List security groups.
  rule-add          Add a security group rule to a security...
  rule-edit         Edit a security group rule in a security...
  rule-list         List security group rules.
  rule-remove       Remove a rule from a security group.

@Neetuj
Copy link
Member

Neetuj commented Aug 9, 2017

@allmightyspiff we are now in open Beta .. which means we have publicized this offering. https://twitter.com/IBMBluemix/status/895048755896045569
bit.ly/2vBoAiF

I think this will be a good time to merge this PR.
@rlrossiter you all set for this to be merged?

@Neetuj
Copy link
Member

Neetuj commented Aug 9, 2017

PR LGTM

@allmightyspiff
Copy link
Member

@Neetuj thanks for that confirmation. I'll merge and release this today.

If a dict is passed in to the add_securitygroup_rules function, it is
serialized as an iterable and sent over XMLRPC. This now does a type
check to make sure it's a list before sending it to be serialized.
@rlrossiter
Copy link
Author

I added a type check to one of the manager functions for security groups. This is now ready to go. 👍

@coveralls
Copy link

Coverage Status

Coverage increased (+0.3%) to 84.657% when pulling d0ba59b on rlrossiter:security-groups into a7cb4dd on softlayer:master.

@allmightyspiff allmightyspiff merged commit 1bfd230 into softlayer:master Aug 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants