Skip to content

Commit

Permalink
Using mgmt_address as the dpid for netconf only nodes
Browse files Browse the repository at this point in the history
For NETCONF only nodes we intended to store the integer representation
of the mgmt_address as the dpid, but the code was actually storing a
packed structure. This might not have been an issue, except that the
JSON perl module couldn't always decode these values. Calling unpack
on this strucutre is enough to get the integer value we wanted, and
fixes the json decoding problem.
  • Loading branch information
jonstout committed Aug 10, 2017
1 parent fe503c2 commit e6accad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions perl-lib/OESS/lib/OESS/Database.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7740,8 +7740,9 @@ sub create_node_instance{
}
}

if(!defined($args{'dpid'})){
$args{'dpid'} = inet_aton($args{'mgmt_addr'});
if (!defined $args{'dpid'}) {
my $data = inet_aton($args{'mgmt_addr'});
$args{'dpid'} = unpack('N', $data);
}

my $res = $self->_execute_query("insert into node_instantiation (node_id,end_epoch,start_epoch,mgmt_addr,admin_state,dpid,vendor,model,sw_version,mpls,openflow ) VALUES (?,?,?,?,?,?,?,?,?,?,?)",[$args{'node_id'},-1,time(),$args{'mgmt_addr'},$args{'admin_state'},$args{'dpid'},$args{'vendor'},$args{'model'},$args{'sw_version'},$args{'mpls'},$args{'openflow'}]);
Expand Down

0 comments on commit e6accad

Please sign in to comment.