Skip to content

Conversation

@fraz3alpha
Copy link

  - When a private subnet id is given in addition to a private
    VLAN id this extra information will be passed to the create
    request to further specify the location of the VM
@fraz3alpha fraz3alpha changed the title Add support for specifying a subnet on a private VLAN WIP: Add support for specifying a subnet on a private VLAN Jan 10, 2018
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 86.828% when pulling 2cf8ca4 on fraz3alpha:support-specifiying-subnet into e5b41ec on softlayer:master.

@fraz3alpha
Copy link
Author

Current code fails the tox analysis:

R:303, 4: Too many branches (22/20) (too-many-branches)

Copy link
Member

@allmightyspiff allmightyspiff left a comment

Choose a reason for hiding this comment

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

Add in public_vlan_subnet support as well.
And add in unit test support for these new features.

'primaryNetworkComponent': {
"networkVlan": {"id": int(public_vlan)}}})

if private_vlan:
Copy link
Member

Choose a reason for hiding this comment

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

My thoughts here are to break out the private/public vlan stuff into a helper function.

if private_vlan or public_vlan:
    network_component = self._create_network_components(private_vlan, public_vlan, private_vlan_subnet, public_vlan_subnet)
    date.update(network_component)

Or something similar would work.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the suggestions, I had just started doing that very thing - however, just to pre-warn you it seems there is a tox check for max number of lines in a module, and we have just crossed the 1000 limit

Copy link
Member

Choose a reason for hiding this comment

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

for that one, you can just add it to the ignored list at the top of this module. I don't want to split this file out at the moment, although I will likely do so in the future.

type=click.INT)
@click.option('--vlan-private-subnet',
help="The ID of the private VLAN subnet on which you want the virtual "
"server placed",
Copy link
Member

Choose a reason for hiding this comment

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

Max line length is 120, so put this all on one line please.

data['private_vlan'] = args['vlan_private']

if args.get('vlan_private_subnet'):
data['private_vlan_subnet'] = args['vlan_private_subnet']
Copy link
Contributor

Choose a reason for hiding this comment

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

I would recommend naming this private_subnet instead of private_vlan_subnet.

help="The ID of the private VLAN on which you want the virtual "
"server placed",
type=click.INT)
@click.option('--vlan-private-subnet',
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here just, --private-subnet.

"networkVlan": {"id": int(private_vlan)}}})
# As per https://stackoverflow.com/questions/37592080/create-a-softlayer-virtual-guest-on-a-specific-subnet
# we can specify a subnet under the VLAN
if private_vlan_subnet:
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be inside the private_vlan if statement since I don't think the API requires a vlan id when supplying a subnet id.

@fraz3alpha
Copy link
Author

Closing this as it was implemented as part of #995 , and that seems to be working well for me now 👍

@fraz3alpha fraz3alpha closed this Sep 6, 2018
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