Set port attributes for trunk subports.

        For baremetal deployments only, set the neutron port attributes
        during the bind_port event.
773180
def update_subports(self, port):
        
        trunk_details = port.get('trunk_details')
        subports = trunk_details['sub_ports']

        host_id = port.get(bc.dns.DNSNAME)
        context = bc.get_context()
        el_context = context.elevated()

        for subport in subports:
            bc.get_plugin().update_port(el_context, subport['port_id'],
                {'port':
                 {bc.portbindings.HOST_ID: host_id,
                  'device_owner': bc.trunk_consts.TRUNK_SUBPORT_OWNER}})

        # Set trunk to ACTIVE status.
        trunk_obj = bc.trunk_objects.Trunk.get_object(
            el_context, id=trunk_details['trunk_id'])
        trunk_obj.update(status=bc.trunk_consts.ACTIVE_STATUS)
880017
def set_ports(self, port0 = 0x00, port1 = 0x00):
        ''
        self.bus.write_byte_data(self.address, self.OUTPUT_PORT0, port0)
        self.bus.write_byte_data(self.address, self.OUTPUT_PORT1, port1)
        return True
664096
def _configure_port_binding(self, is_provider_vlan, duplicate_type,
                                is_native,
                                switch_ip, vlan_id,
                                intf_type, nexus_port, vni):
        """"""

        # This implies VLAN, VNI, and Port are all duplicate.
        # Then there is nothing to configure in Nexus.
        if duplicate_type == const.DUPLICATE_PORT:
            return

        auto_create, auto_trunk = self._gather_config_parms(
            is_provider_vlan, vlan_id)

        # if type DUPLICATE_VLAN, don't create vlan
        if duplicate_type == const.DUPLICATE_VLAN:
            auto_create = False

        if auto_create and auto_trunk:
            LOG.debug("Nexus: create vlan %s and add to interface", vlan_id)
            self.driver.create_and_trunk_vlan(
                switch_ip, vlan_id, intf_type,
                nexus_port, vni, is_native)
        elif auto_create:
            LOG.debug("Nexus: create vlan %s", vlan_id)
            self.driver.create_vlan(switch_ip, vlan_id, vni)
        elif auto_trunk:
            LOG.debug("Nexus: trunk vlan %s", vlan_id)
            self.driver.send_enable_vlan_on_trunk_int(
                switch_ip, vlan_id,
                intf_type, nexus_port, is_native)
9513
def set_neighbor_attribute_map(neigh_ip_address, at_maps,
                               route_dist=None, route_family=VRF_RF_IPV4):
    """"""
    core = CORE_MANAGER.get_core_service()
    peer = core.peer_manager.get_by_addr(neigh_ip_address)

    at_maps_key = const.ATTR_MAPS_LABEL_DEFAULT
    at_maps_dict = {}

    if route_dist is not None:
        vrf_conf =\
            CORE_MANAGER.vrfs_conf.get_vrf_conf(route_dist, route_family)
        if vrf_conf:
            at_maps_key = ':'.join([route_dist, route_family])
        else:
            raise RuntimeConfigError(desc='No VrfConf with rd %s' %
                                          route_dist)

    at_maps_dict[const.ATTR_MAPS_LABEL_KEY] = at_maps_key
    at_maps_dict[const.ATTR_MAPS_VALUE] = at_maps
    peer.attribute_maps = at_maps_dict

    return True
407343
def set_attributes(d, elm):
    """"""
    for key in d:
        elm.setAttribute(key, d[key])
467042
public void bind(ExposedPort exposedPort, Binding binding) {
        if (ports.containsKey(exposedPort)) {
            Binding[] bindings = ports.get(exposedPort);
            ports.put(exposedPort, (Binding[]) ArrayUtils.add(bindings, binding));
        } else {
            if (binding == null) {
                ports.put(exposedPort, null);
            } else {
                ports.put(exposedPort, new Binding[] {binding});
            }
        }
    }
364827
def set_http_port(port=80):
    '''
    
    '''
    _current = global_settings()

    if _current['Global Settings']['HTTP_PORT']['VALUE'] == port:
        return True

    _xml = """<RIBCL VERSION="2.0">
                <LOGIN USER_LOGIN="adminname" PASSWORD="password">
                  <RIB_INFO MODE="write">
                    <MOD_GLOBAL_SETTINGS>
                      <HTTP_PORT value="{0}"/>
                    </MOD_GLOBAL_SETTINGS>
                  </RIB_INFO>
                </LOGIN>
              </RIBCL>""".format(port)

    return __execute_cmd('Set_HTTP_Port', _xml)
1192315
function Bootstrap_setListenPort(port) {
        if (Type.isNumber(port)) {
            this.listenPort = port;
        } else {
            this.listenPort = parseInt(port);
        }
    }
740912
def ports_mapping(self, ports):
        
        if ports != self._ports:
            if len(self._mappings) > 0:
                raise NodeError("Can't modify a hub already connected.")

            port_number = 0
            for port in ports:
                port["name"] = "Ethernet{}".format(port_number)
                port["port_number"] = port_number
                port_number += 1

            self._ports = ports
1053899
def set_lan_port(self, port_id, mac=None):
        
        port_handler = _parse_physical_port_id(port_id)
        port = self._find_port(port_handler)
        if port:
            port_handler.set_lan_port(port, mac)
        else:
            self._add_port(port_handler, port_handler.create_lan_port(mac))
554161
def SetupPrometheusExportsFromConfig():
    """"""
    port = getattr(settings, 'PROMETHEUS_METRICS_EXPORT_PORT', None)
    port_range = getattr(
        settings, 'PROMETHEUS_METRICS_EXPORT_PORT_RANGE', None)
    addr = getattr(settings, 'PROMETHEUS_METRICS_EXPORT_ADDRESS', '')
    if port_range:
        SetupPrometheusEndpointOnPortRange(port_range, addr)
    elif port:
        SetupPrometheusEndpointOnPort(port, addr)
424169
public void setSubnetwork(int nodeId, int subnetwork) {
        if (subnetwork > 127)
            throw new IllegalArgumentException("Number of subnetworks is currently limited to 127 but requested " + subnetwork);

        byte[] bytes = new byte[1];
        bytes[0] = (byte) subnetwork;
        da.setBytes(nodeId, bytes, bytes.length);
    }
544538
def port_bindings(self, value):
        
        if isinstance(value, (list, dict)):
                self._port_bindings = self._convert_port_bindings(value)
        elif value is None:
            self._port_bindings = None
        else:
            raise TypeError('port bindings must be a dict, list, or None. {0} was passed.'.format(type(value)))
43943
void configurePort(String port) {

        if (StringUtils.isNotBlank(port)) {
            try {
                this.port = Integer.parseInt(port);
                log.info("Using port {}", this.port);
            } catch (NumberFormatException e) {
                log.info("Unable to parse server PORT variable ({}). Defaulting to port {}", port, this.port);
            }
        }
    }
1089657
def add_nexusport_binding(port_id, vlan_id, vni, switch_ip, instance_id,
                          is_native=False, ch_grp=0):
    """"""
    LOG.debug("add_nexusport_binding() called")
    session = bc.get_writer_session()
    binding = nexus_models_v2.NexusPortBinding(port_id=port_id,
                  vlan_id=vlan_id,
                  vni=vni,
                  switch_ip=switch_ip,
                  instance_id=instance_id,
                  is_native=is_native,
                  channel_group=ch_grp)
    session.add(binding)
    session.flush()
    return binding
583269
def configure_snmp(community, snmp_port=161, snmp_trapport=161):
    '''
    
    '''
    _xml = """<RIBCL VERSION="2.2">
                <LOGIN USER_LOGIN="x" PASSWORD="y">
                  <RIB_INFO mode="write">
                    <MOD_GLOBAL_SETTINGS>
                      <SNMP_ACCESS_ENABLED VALUE="Yes"/>
                      <SNMP_PORT VALUE="{0}"/>
                      <SNMP_TRAP_PORT VALUE="{1}"/>
                    </MOD_GLOBAL_SETTINGS>

                   <MOD_SNMP_IM_SETTINGS>
                     <SNMP_ADDRESS_1 VALUE=""/>
                     <SNMP_ADDRESS_1_ROCOMMUNITY VALUE="{2}"/>
                     <SNMP_ADDRESS_1_TRAPCOMMUNITY VERSION="" VALUE=""/>
                     <RIB_TRAPS VALUE="Y"/>
                     <OS_TRAPS VALUE="Y"/>
                     <SNMP_PASSTHROUGH_STATUS VALUE="N"/>
                  </MOD_SNMP_IM_SETTINGS>
                </RIB_INFO>
              </LOGIN>
           </RIBCL>""".format(snmp_port, snmp_trapport, community)

    return __execute_cmd('Configure_SNMP', _xml)
709416
protected void configureCustomizeBinding(Client client, QName portName) {
        //put all properties defined in ibm-ws-bnd.xml into the client request context
        Map<String, Object> requestContext = client.getRequestContext();
        if (null != requestContext && null != wsrInfo) {
            PortComponentRefInfo portRefInfo = wsrInfo.getPortComponentRefInfo(portName);

            Map<String, String> wsrProps = wsrInfo.getProperties();
            Map<String, String> portProps = (null != portRefInfo) ? portRefInfo.getProperties() : null;

            if (null != wsrProps) {
                requestContext.putAll(wsrProps);
            }

            if (null != portProps) {
                requestContext.putAll(portProps);
            }

            if (null != wsrProps && Boolean.valueOf(wsrProps.get(JaxWsConstants.ENABLE_lOGGINGINOUTINTERCEPTOR))) {
                List<Interceptor<? extends Message>> inInterceptors = client.getInInterceptors();
                inInterceptors.add(new LoggingInInterceptor());
                List<Interceptor<? extends Message>> outInterceptors = client.getOutInterceptors();
                outInterceptors.add(new LoggingOutInterceptor());
            }
        }

        Set<ConfigProperties> configPropsSet = servicePropertiesMap.get(portName);
        client.getOutInterceptors().add(new LibertyCustomizeBindingOutInterceptor(wsrInfo, securityConfigService, configPropsSet));
        //need to add an interceptor to clean up HTTPTransportActivator.sorted & props via calling HTTPTransportActivator. deleted(String)
        //Memory Leak fix for 130985
        client.getOutInterceptors().add(new LibertyCustomizeBindingOutEndingInterceptor(wsrInfo));

    }