Skip to content

Function adding segment #1

@blakkheimgw

Description

@blakkheimgw

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions