OpenNetAdmin

Track. Automate. Configure.

Home About Features Community Develop
Download this project as a tar.gz file

Alcatel cfg_archive issue

joshw

12-04-2012 22:03:10

Matt,

We're having some issues running config archives against some of our Alcatel network devices. ONA is all good as far as cfg_archive, getpw, etc and configs ARE being imported into the DB. The issue I think is that the Alcatel command to show the configuration has some lines that begin with '#'. Specifically, there are two lines that are not being stripped out by our cfg_archive.alcatel.ALCATEL_CONFIG.sed files. I'm thinking that this is because bash is interpretting these hash marks to be comments so it won't change the text. Here's a snippet of the Alcatel config......

# TiMOS-B-3.0.R3 both/mpc ALCATEL SAS-M 24F 2XFP 7210 Copyright (c) 2000-2011 Alcatel-Lucent.
# All rights reserved. All use subject to applicable license agreements.
# Built on Wed Mar 30 21:36:57 IST 2011 by builder in /builder/3.0B1/R3/panos/main
# Generated FRI APR 13 03:44:24 2012 UTC

----- normal config from here on out


the # Generated statement is similar to Cisco uptime, it shows current time of the requested command. With that line not being removed, ONA's MD5SUMs for the configuration are different and ONA thinks it needs to import due to a config change.

I thought about trying to escape the hash in cfg_archive for the CMDOUTPUT var but don't think this is wise globally.

Any ideas?

Thanks,

Josh

Matt

16-04-2012 14:06:06

It's either something funky in the code or the .sed statement is not able to figure things out. It should be processing the sed command outside of anything bash would care about so we should do some testing to narrow down if it is a problem in the sed or after that when bash is processing.

What does your cfg_archive.alcatel.ALCATEL_CONFIG.sed file look like? I can try some tests here to see if I can recreate.

joshw

16-04-2012 15:13:03

Hey Matt -

Sed config is only /Generated/d and /Finished/d

Funny thing is that is if I do the following 'cat /opt/ona/cfg_archive_local/CFG_file | sed -f /opt/ona/etc/cfg_archive.alcatel.ALCATEL_CONFIG.sed' - that strips out those lines just fine and I'm left with the config that we would want to go into the DB.

Matt

17-04-2012 14:27:48

Well it seems the sed should be working fine. I did some basic tests with your config snip and that sed statement and it does what I expect.

Maybe a little more info on exactly what the issue is you are seeing? I assume its storing the config fine but it has the timestamps still so it ALWAYS gets an update due to that?

One other thought is to put the following in the cfg_archive script, before and after the sed exececution to see if the config has what is expected?:

[ -z $DEBUGON ] || ONA_LOG "DEBUG => $HOST: $OUTPUT_MAIN"

I dont believe there would be anything in the script that would care about the # at this point. hmmm.

joshw

18-04-2012 13:10:50

Matt,

I found the issue. The cfg_arhive/getpw/sed piece was working fine. Turns out there were some php preg_replace options in /opt/ona/www/modules/ona/configuration.inc.php for the config_add piece.


$options['config'] = preg_replace('/\\\"/','"',$options['config']);
$options['config'] = preg_replace('/\\\=/','=',$options['config']);


I started looking there after i noticed that the md5sums never changed, but were different for the config in the DB and the config from OUTPUT_MAIN. Looks like it was just being changed on it's way into the DB.

--Josh

Matt

19-04-2012 16:08:34

ahh yes.. I remember those replaces.. BUT I cant recall the exact senario as to why they are there! :) It may be related to it passing through dcm.pl..

well at least you know what is doing it.. now its an issue of figuring out the right way to deal with it....................