def _add_switches_node(parent_elem, aggregate, slice_urn, available):
    
    switches_elem = et.SubElement(parent_elem, SWITCHES_TAG)
    
    switches = OpenFlowSwitch.objects.filter(aggregate=aggregate)

    if available != None:
        switches = switches.filter(available=available)

    for switch in switches:
        switch_elem = et.SubElement(
            switches_elem, SWITCH_TAG, {
                URN: _dpid_to_urn(switch.datapath_id),
            },
        )
        _add_ports(switch_elem, switch, slice_urn)
        
    return switches_elem
Add the switches tag and all switches
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/plugins/openflow/plugin/gapi/rspec.py/_add_switches_node