[racktables-users] Re: CSV import plugin

  • From: Erik Ruiter <erik.ruiter@xxxxxxxxxxx>
  • To: "racktables-users@xxxxxxxxxxxxx" <racktables-users@xxxxxxxxxxxxx>
  • Date: Wed, 24 Sep 2014 18:32:54 +0000

Hi Lucas,

Nice that it works, I am happy that more people find it useful.
Thanks for the updates for the interface types, I updated the correct labels in 
the documentation.

I also found out (looking at the commitAddPort() function) that it is already 
possible to use other inner interface types.

If you want to have a different inner interface type, eg . GBIC (type 3), you 
can add this with a hyphen preceding the outer interface type.
For example: OBJECT;7;myRouterCN1;myRouterLB1;;1/1/[1-2];3-1204  <—
If you don’t specify the inner interface type, it defaults to hardwire.

I updated the documentation to reflect this feature.

Best regards,

Erik.


From: Lucas Aimaretto <laimaretto@xxxxxxxxx<mailto:laimaretto@xxxxxxxxx>>
Reply-To: 
"racktables-users@xxxxxxxxxxxxx<mailto:racktables-users@xxxxxxxxxxxxx>" 
<racktables-users@xxxxxxxxxxxxx<mailto:racktables-users@xxxxxxxxxxxxx>>
Date: Wednesday, September 24, 2014 at 15:25
To: "racktables-users@xxxxxxxxxxxxx<mailto:racktables-users@xxxxxxxxxxxxx>" 
<racktables-users@xxxxxxxxxxxxx<mailto:racktables-users@xxxxxxxxxxxxx>>
Subject: [racktables-users] Re: CSV import plugin

Hi Erik!

So, I've tried your updated plugin and is working great! Now I can insert 
routers, link them together and assign IP addresses in one shot!

This is an example script that I've tried and is working very nice!

OBJECT;7;myRouterCN1;myRouterLB1;;1/1/[1-2];1204
OBJECT;7;myRouterCN2;myRouterLB2;;1/1/[1-2];1204
CABLELINK;myRouterCN1;1/1/1;myRouterCN2;1/1/2;
IP;20.1.3.0/30;Link_network;TRUE<http://20.1.3.0/30;Link_network;TRUE>;
IP;20.1.3.4/30;Shared_network;TRUE<http://20.1.3.4/30;Shared_network;TRUE>;
OBJECTIP;myRouterCN1;toCN2;20.1.3.1;point2point
OBJECTIP;myRouterCN1;toCN2;20.1.3.5;shared
OBJECTIP;myRouterCN2;toCN1;20.1.3.2;point2point
OBJECTIP;myRouterCN2;toCN1;20.1.3.5;shared

Just one thing to note: the type of the IP interfaces need to match any type 
within the output of the following query:

select distinct type from IPv4Allocation;

This output is then:

virtual
regular
point2point
shared

... because I've tried to create an IP interface of type 'point-to-point' and 
it didn't work (it was created as 'connected' if I would do so ...), but when I 
created it as 'point2point' (as in the script) it just worked perfect.

I have to modify the hardwired inner interface and added the type 1204 
(1000BaseLX). There is no problem with this approach. The only thing that I'd 
require if possible is the possibility of using some other type of inner 
interface (other than hardwired) because some of our routers do support SFP 
ports. Do you think it is feasible to do it?

In any case thank you very much for this plugin, it is just perfect so far!

Regards!

Lucas


On Wed, Sep 24, 2014 at 7:28 AM, Erik Ruiter 
<erik.ruiter@xxxxxxxxxxx<mailto:erik.ruiter@xxxxxxxxxxx>> wrote:
Hi Lucas,

This is not difficult.
I just added the following:

Importing Object IP interfaces

 Syntax: OBJECTIP; Objectname; OS Interface name; IP address; Type
 Value 1, OBJECTIP
 Value 2, Objectname: Specifies the name of the object
 Value 3, OS Interface name: Specifies the name of the interface to be added
 Value 4, IP address: Specifies the ip address of the interface to b e added 
(IPv4 or Ipv6) no subnet mask required
 Value 5, Type: Chooses the type of interface to be added. Can be: connected, 
loopback, shared, router, point-to-point. The default type is: router

 Examples:

 OBJECTIP;myRouter;eth0;10.1.3.1;connected
 Creates an IP interface name eth0, with address 10.1.3.1 and type 'connected', 
which is added to the myRouter object.


Please try it and let me know if it works.

Best regards,

Erik.



From: Lucas Aimaretto <laimaretto@xxxxxxxxx<mailto:laimaretto@xxxxxxxxx>>
Reply-To: 
"racktables-users@xxxxxxxxxxxxx<mailto:racktables-users@xxxxxxxxxxxxx>" 
<racktables-users@xxxxxxxxxxxxx<mailto:racktables-users@xxxxxxxxxxxxx>>
Date: Tuesday, September 23, 2014 at 22:39
To: "racktables-users@xxxxxxxxxxxxx<mailto:racktables-users@xxxxxxxxxxxxx>" 
<racktables-users@xxxxxxxxxxxxx<mailto:racktables-users@xxxxxxxxxxxxx>>
Subject: [racktables-users] Re: CSV import plugin

Hi Erik,

Very nice plugin! I'll give it a try right away. I do have tons of IP subnets 
and VLANs to be imported into racktables.

As far as I've seen, your script does support:
- importing objects;
- importing racks;
- assigning rackspaces;
- linking ports;
- importing vlans;
- importing IP spaces;

Now, how difficult is it to implement the creation of interfaces with their IP 
address into a router?

Example:

IPinterface;10.1.3.1;to_router_B;routerA;connected
Creates the IP interface called "to_router_B" of type "connected" within 
"routerA"   with IP address 10.1.3.1

Thanks!

Regards,

Lucas


On Mon, Jul 14, 2014 at 6:17 AM, Erik Ruiter 
<erik.ruiter@xxxxxxxxxxx<mailto:erik.ruiter@xxxxxxxxxxx>> wrote:
Hi Olivier,

Thanks for the feedback.
Other formats would indeed be nice, but that would be a lot of work.
For our internal usage there is not much need at the moment.

Best regards,

Erik.


From: Olivier Contant 
<Olivier.Contant@xxxxxxxxxxxxxxxxx<mailto:Olivier.Contant@xxxxxxxxxxxxxxxxx>>
Reply-To: 
"racktables-users@xxxxxxxxxxxxx<mailto:racktables-users@xxxxxxxxxxxxx>" 
<racktables-users@xxxxxxxxxxxxx<mailto:racktables-users@xxxxxxxxxxxxx>>
Date: Friday, July 11, 2014 at 17:58
To: "racktables-users@xxxxxxxxxxxxx<mailto:racktables-users@xxxxxxxxxxxxx>" 
<racktables-users@xxxxxxxxxxxxx<mailto:racktables-users@xxxxxxxxxxxxx>>
Subject: [racktables-users] Re: CSV import plugin

Thank you very much for this plugin.

Maybe I could push you even more and ask you to support other format like json, 
xml, :)

Olivier Contant
System Administrator, Triton Digital

1440 Ste-Catherine W., Suite 1200 | Montreal, Qc, H3G 1R8
+1.514.448.4037<tel:%2B1.514.448.4037>
olivier.contant@xxxxxxxxxxxxxxxxx<mailto:olivier.contant@xxxxxxxxxxxxxxxxx>
________________________________
From: 
racktables-users-bounce@xxxxxxxxxxxxx<mailto:racktables-users-bounce@xxxxxxxxxxxxx>
 
[racktables-users-bounce@xxxxxxxxxxxxx<mailto:racktables-users-bounce@xxxxxxxxxxxxx>]
 on behalf of Erik Ruiter 
[erik.ruiter@xxxxxxxxxxx<mailto:erik.ruiter@xxxxxxxxxxx>]
Sent: July 11, 2014 10:34 AM
To: racktables-users@xxxxxxxxxxxxx<mailto:racktables-users@xxxxxxxxxxxxx>
Subject: [racktables-users] CSV import plugin

Hi All,

To make it easier to import objects and other things in Racktables, I built an 
CSV import plugin which enables loading batches of data.
It adds an CSV import page on the configuration menu screen.
From here you can choose to either import a CSV file, or paste some manual CSV 
lines in a textbox.

The script currently supports importing of Objects, Racks, VLANs and IP space.
It also supports linking ports, and assigning rackspace to objects.

The syntax of the CSV formatting is explained in the source code of the plugin.

I hope this might be useful to you. Feedback is very welcome of course.

You can find the plugin at:

https://github.com/sara-nl/racktables-contribs/blob/master/csv_import.php


Best Regards,

Erik Ruiter.



--
"Antes teníamos hambre y mirábamos el reloj para saber qué hora era. Ahora 
miramos el reloj para saber si tenemos hambre." -- Ernesto Sábato



--
"Antes teníamos hambre y mirábamos el reloj para saber qué hora era. Ahora 
miramos el reloj para saber si tenemos hambre." -- Ernesto Sábato

Other related posts: