TwoWheelDev / gns3-converter

GNS3 Topology Converter
GNU General Public License v3.0
14 stars 13 forks source link

-o not working #3

Closed rednectar closed 10 years ago

rednectar commented 10 years ago

I tried -o - but it still asked me for a directory name - see below:

user@GNS3v1 ~/GNS3/projects/Test Converter $ gns3-converter -o topology.gns3 topology.net GNS3 Topology Converter Please enter a name for this topology: WHY Your topology has been converted and can found in: /home/user/GNS3/projects/Test Converter/topology.gns3/WHY

I would have expected the converted topology to appear in /home/user/GNS3/projects/Test Converter/topology.gns3

TwoWheelDev commented 10 years ago

The -o (or --ouput) sets the output directory under which the new topology is created.

By default this the current working directory. The name you enter willl always be asked to populate the name field in the new topology and to create the project directory (and associated directories).

See the examples in the docs: http://gns3-converter.readthedocs.org/en/latest/usage.html#example

rednectar commented 10 years ago

Dan,

Thanks for your great work. I can see that I interpreted the -o (or --output) incorrectly. But I still think it is confusing. Consider these scenarios: I have a GNS3 v8.x project called DHCP_Example. In GNS3 v0.8.x that is represented by a directory called DHCP_Example and in that directory is the _topology.net_ file for that project.

Scenario 1

I decide to convert it to GNS3v1, figuring that I will call the GNS3v1 project DHCP_Example_v1. So I issue a command:

gns3-converter -o DHCP_Example_v1 topology.net

I expect that a new directory will be created (just like in GNS3v1) called DHCP_Example_v1 and in that directory will be a DHCP_Example_v1.gns3 file and a DHCP_Example_v1-files directory with the configs etc intact.

But that is NOT what happens. Instead, I get asked to "enter a name for this topology". All of my topologies are called WTF - because I do not understand WHY I'm being asked for a name - isn't that why I put in the -o option - to NAME this topology?????

Scenario 2

I decide to convert my existing project called DHCP_Example to GNS3v1, but keeping it in the same directory. So So I issue a command:

gns3-converter topology.net

I expect that the existing topology will be created in the existing directory and that a file will be produced in the current directory called DHCP_Example.gns3 file and a directory called DHCP_Example-files will be created off the current directory with the configs files etc.

But that is NOT what happens. Instead, I get asked to "enter a name for this topology". This is completely unnecessary - the topology already has a name - it is the name of the current directory!!!

Finally, I think that there could be a default topology name - ie topology.net - since most topologies have been called that for the last few years. So I aught to be able to go to a directory like RIP Lab and simply issue a command:

gns3-converter and expect that I end up with:

topology.net converted to RIP Lab.gns3; and a RIP Lab-files directory created in the current directory and populated with the configs etc.

So my suggestions are:

  1. Make the -o | --output option replace the function of the enter a name for this topology prompt.
  2. If no -o | --output option is supplied, do the conversion in the current directory, based on the name of the current directory - ie, if the current directory is called Exercise7 - create a Exercise7.gns3 file in that directory, and a Exercise7-files folder with the configs - mimicking the way GNS3v1 manages its file structure.
  3. If no topology file is given, assume that you want to use topology.net in the current directory
  4. If a topology is specified with a full path - eg:

gns3-converter /home/GNS3/Projects/MyLab/topology.net

then the topology will be converted in the /home/GNS3/Projects/MyLab folder creating /home/GNS3/Projects/MyLab/MyLab.gns3 and /home/GNS3/Projects/MyLab/MyLab-files

  1. The output directory can be overridden with the -o | --output option, so the command

gns3-converter -o /home/GNS3/NewProjects/Lab5 /home/GNS3/Projects/MyLab/topology.net

would convert the /home/GNS3/Projects/MyLab/topology.net creating /home/GNS3/NewProjects/Lab5/Lab5.gns3 and /home/GNS3/NewProjects/Lab5/Lab5-files

I don't mean to make more work for you, just to reduce the support you may have to face in the future :sunglasses:

TwoWheelDev commented 10 years ago

Thankyou very much for the detailed inspection! It's sometimes difficult to imagine how an end user will interpret things!

I mostly agree with your points here, I think I shall look at adding a parameter, perhaps -n | --name which should be optional, if not set use the projects' folder name.

With regards to output in the current directory... I prefer to always have the new project created seperately. This means the user can easily move the converted project without having to know which files and folders belong to what.

Default topology filename... this is indeed something I've been thinking about implementing. Again I shall try and make this able to be overridden.

In summary:

TwoWheelDev commented 10 years ago

I have now implemented part of this... It is no longer necessary to specify topology.net file if it's in the current directory.

The topology now gets it's name from the projects' folder or from the -n | --name option

This will be included in the 0.2.0 release

rednectar commented 10 years ago

Dan,

I've just tested v0.1.4.dev1, and it is certainly looking a lot slicker. But...

if I have a file called ProjectX in my GNS3v1 projects directory and I do this: cd ~/GNS3/projects/ProjectX gns3-converter

then I end up with a kind of "duplicated" ProjectX directory ie the converted files are placed in: ~/GNS3/projects/ProjectX/ProjectX with the .gns3 file and working files becoming: ~/GNS3/projects/ProjectX/ProjectX/ProjectX.gns and ~/GNS3/projects/ProjectX/ProjectX/ProjectX-files which I think is a bit convoluted. I think they would be better off being placed in the current directory - so you end up with ~/GNS3/projects/ProjectX/ProjectX.gns and ~/GNS3/projects/ProjectX/ProjectX-files Sure, the old topology.net file and configs and working files will still be there, but who cares? It will be a simple task to write a "clean-up" script to remove old files if required. Better than having a double-barrelled directory naming system.

And will probably be MUCH easier to do a FULL conversion of topologies that have snapshots (as may of mine do) - which I hope will be implemented soon (I'm sick of waiting). I'm not sure how Jeremy intends to implement snapshots in the new version, but I expect it will be similar to the current version (I hope). But keep in mind that when it is implemented, the conversion program will need to be able to convert the snapshots too. The simpler you keep the directory structure (=the closer to the current structure) the easier this will be.

CW

TwoWheelDev commented 10 years ago

You've convinced me now! I shall get the changes made shortly

rednectar commented 10 years ago

Thanks - BTW: I forgot most importantly that doing it the way suggested above keeps the instructions intact as well - very important for my stuff. CW