CLI: minor changes to python binding code

This commit is contained in:
Srivats P. 2014-06-16 19:53:03 +05:30
parent a6bfb0d393
commit 0d3b36b943
3 changed files with 10 additions and 7 deletions

View File

@ -25,4 +25,4 @@ with open(dirname(__file__) + '/pkg_info.json') as f:
__version__ = _info['version']
__revision__ = _info['revision']
__log__ = logging.getLogger('ostinato')
__log__ = logging.getLogger(__name__)

View File

@ -91,9 +91,10 @@ try:
stream_cfg.port_id.CopyFrom(tx_port.port_id[0])
s = stream_cfg.stream.add()
s.stream_id.id = stream_id.stream_id[0].id
s.core.is_enabled = 1
s.core.is_enabled = True
s.control.num_packets = 5
# setup stream protocols as mac:eth2:ip4:udp:payload
p = s.protocol.add()
p.protocol_id.id = ost_pb.Protocol.kMacFieldNumber
p.Extensions[mac].dst_mac = 0x001122334455
@ -104,9 +105,11 @@ try:
p = s.protocol.add()
p.protocol_id.id = ost_pb.Protocol.kIp4FieldNumber
p.Extensions[ip4].src_ip = 0x01020304
p.Extensions[ip4].dst_ip = 0x05060708
p.Extensions[ip4].dst_ip_mode = Ip4.e_im_inc_host
# reduce typing by creating a shorter reference to p.Extensions[ip4]
ip = p.Extensions[ip4]
ip.src_ip = 0x01020304
ip.dst_ip = 0x05060708
ip.dst_ip_mode = Ip4.e_im_inc_host
s.protocol.add().protocol_id.id = ost_pb.Protocol.kUdpFieldNumber
s.protocol.add().protocol_id.id = ost_pb.Protocol.kPayloadFieldNumber

View File

@ -50,7 +50,7 @@ class OstinatoRpcController(RpcController):
class OstinatoRpcChannel(RpcChannel):
def __init__(self):
self.log = logging.getLogger('ostinato.rpc')
self.log = logging.getLogger(__name__)
self.log.debug('opening socket')
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@ -77,7 +77,7 @@ class OstinatoRpcChannel(RpcChannel):
error = ''
try:
self.log.debug('invoking RPC %s(%s): %s', method.name,
self.log.info('invoking RPC %s(%s): %s', method.name,
type(request).__name__, response_class.__name__)
self.log.debug('serializing request arg %s', request)
req = request.SerializeToString()