def wfa_halow_set(self, cmd, value): attrs = [] attrs.append(netlink.NulStrAttr(NL_HALOW_PARAM_NAME, cmd)) attrs.append(netlink.NulStrAttr(NL_HALOW_PARAM_STR_VAL, value)) req = netlink.GenlMessage(self._fid, NL_HALOW_SET_DUT, flags=netlink.NLM_F_REQUEST | netlink.NLM_F_ACK, attrs=attrs) resp = req.send_and_recv(self._conn) resp_attrs = netlink.parse_attributes(resp.payload[4:]) return resp_attrs[NL_HALOW_RESPONSE].nulstr()
def wfa_capi_sta_set_11n(self, cmd, value): attrs = [] attrs.append(netlink.NulStrAttr(NL_WFA_CAPI_INTF_ID, b'test')) attrs.append(netlink.NulStrAttr(NL_WFA_CAPI_PARAM_NAME, cmd)) attrs.append(netlink.NulStrAttr(NL_WFA_CAPI_PARAM_STR_VAL, value)) req = netlink.GenlMessage(self._fid, NL_WFA_CAPI_STA_SET_11N, flags=netlink.NLM_F_REQUEST | netlink.NLM_F_ACK, attrs=attrs) resp = req.send_and_recv(self._conn) resp_attrs = netlink.parse_attributes(resp.payload[4:]) return resp_attrs[NL_WFA_CAPI_PARAM_RESP].nulstr()
def session_create(self, tunnel_id, session_id, peer_session_id, name): """ Creates a new ethernet session over the tunnel. :param tunnel_id: Local tunnel identifier :param session_id: Local session identifier :param peer_session_id: Remote peer session identifier :param name: Interface name """ msg = self._create_message( L2TP_CMD_SESSION_CREATE, [ netlink.U32Attr(L2TP_ATTR_CONN_ID, tunnel_id), netlink.U32Attr(L2TP_ATTR_SESSION_ID, session_id), netlink.U32Attr(L2TP_ATTR_PEER_SESSION_ID, peer_session_id), netlink.U16Attr(L2TP_ATTR_PW_TYPE, L2TP_PWTYPE_ETH), # TODO: Cookies. netlink.NulStrAttr(L2TP_ATTR_IFNAME, name), ]) msg.send(self.connection) try: self.connection.recv() except OSError, e: if e.errno == errno.EEXIST: raise L2TPSessionExists(session_id) raise NetlinkError
def destroy_radio(self, radio_id): try: int(radio_id) attrs = [netlink.U32Attr(HWSIM_ATTR_RADIO_ID, int(radio_id))] except ValueError: attrs = [netlink.NulStrAttr(HWSIM_ATTR_RADIO_NAME, radio_id)] msg = netlink.GenlMessage(self._fid, HWSIM_CMD_DESTROY_RADIO, flags = netlink.NLM_F_REQUEST | netlink.NLM_F_ACK, attrs = attrs) msg.send_and_recv(self._conn)
def wfa_capi_sta_get_info(self): attrs = [] attrs.append(netlink.NulStrAttr(NL_WFA_CAPI_INTF_ID, b'test')) req = netlink.GenlMessage(self._fid, NL_WFA_CAPI_STA_GET_INFO, flags=netlink.NLM_F_REQUEST | netlink.NLM_F_ACK, attrs=attrs) resp = req.send_and_recv(self._conn) resp_attrs = netlink.parse_attributes(resp.payload[4:]) return resp_attrs
def create_radio(self, n_channels=None, use_chanctx=False, hwname=None, no_vdev=False): attrs = [] if n_channels: attrs.append(netlink.U32Attr(HWSIM_ATTR_CHANNELS, n_channels)) if use_chanctx: attrs.append(netlink.FlagAttr(HWSIM_ATTR_USE_CHANCTX)) if hwname: attrs.append(netlink.NulStrAttr(HWSIM_ATTR_RADIO_NAME, hwname)) if no_vdev: attrs.append(netlink.FlagAttr(HWSIM_ATTR_NO_VDEV)) msg = netlink.GenlMessage(self._fid, HWSIM_CMD_CREATE_RADIO, flags = netlink.NLM_F_REQUEST | netlink.NLM_F_ACK, attrs = attrs) return msg.send_and_recv(self._conn).ret