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

Function adding segment #1

Open
blakkheimgw opened this issue Dec 21, 2017 · 0 comments
Open

Function adding segment #1

blakkheimgw opened this issue Dec 21, 2017 · 0 comments

Comments

@blakkheimgw
Copy link

Hello,

I think there is a problem in the following function code in controller_bcf.py :

def segment(self, name, tenant, interface_groups=[], origination='', action='add'):
	path = '/tenant[name="%s"]/segment[name="%s"]?select=name&single=true' % (tenant, name)
	response = self.make_request('GET', path, data='{}')
	config_present = True if response.status_code != 404 else False

	path = '/tenant[name="%s"]/segment[name="%s"]' %(tenant, name)
	data = '{"name": "%s", "origination": "%s"}' % (name, origination)
	if action == 'add' and not config_present:
		response = self.make_request('PUT', path, data=data)
	elif action != 'add' and config_present:
		return self.make_request('DELETE', path, data=data)
		
	if interface_groups:
		for interface_group, vlan in interface_groups:
			result = self.interface_group_segment_membership(interface_group, name, tenant, vlan=vlan)

How am I supposed to add a new segment in one or more interface groups when calling this function ? The interface_groups=[] variable seems to be a list so how the following could work :

if interface_groups:
	for interface_group, vlan in interface_groups:
		result = self.interface_group_segment_membership(interface_group, name, tenant, vlan=vlan)

Regards.

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

No branches or pull requests

1 participant