Reply

Get all extensible attributes for a network

Member
Posts: 1
4270     0

Hello, new member/customer. I am trying to create a vRO workflow that will get all the extensible attributes for a network. I am using the vRO 4.0.1 plugin for NIOS. I found an action that gets all networks based on an extensible attribute (findNetworksByEA) but need it the other way around. I haven't searched this forum directly but will be starting now. Has anyone done this of have any hints? Thanks in advance for any help.

Re: Get all extensible attributes for a network

Techie
Posts: 8
4271     0

I just wrote some code for this. Our network has extenisble attributes of of building, business unit, floor, site, and location code. I modifed a the snapin bloxtools workflow written in perl. For simplicty in other to get these extensible attributes you have to search it in a extensible attributes that are already exits.

 

The documention on network shows this

 # search for all DHCP Network objects defining "Santa Clara" for "Site" extensible attribute
     my @retrieved_objs = $session->search(
       object                => "Infoblox::DHCP::Network",
       extensible_attributes => { 'Site' => 'Santa Clara' }
     );

 I was able to get all the extensible attributes return just by searching building and a " " . So you should be able to do something like this and it will return not only the buiding extensible attributes but also the rest.

 # search for all DHCP Network objects defining "Santa Clara" for "Site" extensible attribute
     my @retrieved_objs = $session->search(
       object                => "Infoblox::DHCP::Network",
       extensible_attributes => { 'Building' => "" }
     );

 

 

Original perl script that does this

my $otype = "Infoblox::DHCP::Network";
   $otype = "Infoblox::DHCP::IPv6Network" if $subnet =~ /:/ ;

my @networks = $sdb->search(
           object => $otype,
           comment => $comment,
           network => $subnet,
		   extensible_attributes => { 'Building' => "" }
		   
);

# get just the list of network names

# now we sort this
# (FYI you could use a "Schwartzian Transform" if you care)
# my %sorted = map { $_, $names{$_} } sort WebUI::by_ip keys %names ;

if ( @networks ) {
    my @records = $sdb->reduce( \@networks , 
        'network' , 'comment' , 'members', 'extensible_attributes' );
    print $sdb->inform(@records);
}
else {
    print $sdb->informtext( $sdb->status_detail() );
}

exit ;

 

 

UI-custom.js that displas the extensible attributes in the GUI

IB.controlPanel.setEAFields( [ "Building", "Business Unit", "Floor", "Site", "Location Code" ] );

 

Not sure if this is going to solve the problem or what environment you are using but this was my solution.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You