Cant find domain 'INCHARGE' in broker 'localhost:426'

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gawasthi
    New Member
    • May 2007
    • 5

    Cant find domain 'INCHARGE' in broker 'localhost:426'

    Hi,
    I am absolutely new to perl and for a specific reqmt I am running the following script:

    [CODE=perl]
    #!/usr/bin/perl
    use warnings;
    use lib '/opt/InCharge65/IP/smarts/perl/5.6.1/lib';
    use InCharge::sessi on;
    $session = InCharge::sessi on->init();
    $session = InCharge::sessi on->new( "INCHARGE" );
    $session = InCharge::sessi on->new(
    broker => "10.213.31.209: 426",
    domain => "IPVPN-APM2",
    username => "admin",
    password => "changeme",
    traceServer => 1,
    );
    $object = $session->create( "Router::crossr oads" );
    $session->detach( );
    [/CODE]

    The errors that I am getting are:

    Name "main::obje ct" used only once: possible typo at ./routerpl.pl line 14.
    [8] Cant find domain 'INCHARGE' in broker 'localhost:426' , stopped at ./routerpl.pl line 5

    PLEASE HELP SOON
    Thanks
    Gaurav
    Last edited by miller; May 23 '07, 04:40 PM. Reason: Code Tag and ReFormatting
  • prn
    Recognized Expert Contributor
    • Apr 2007
    • 254

    #2
    Originally posted by gawasthi
    Hi,
    I am absolutely new to perl and for a specific reqmt I am running the following script:
    [code=perl]#!/usr/bin/perl
    use warnings;
    use lib '/opt/InCharge65/IP/smarts/perl/5.6.1/lib';
    use InCharge::sessi on;
    $session = InCharge::sessi on->init();
    $session = InCharge::sessi on->new( "INCHARGE" );
    $session = InCharge::sessi on->new(
    broker=>"10.213 .31.209:426",
    domain=>"IPVPN-APM2",
    username=>"admi n",
    password=>"chan geme",
    traceServer => 1
    );
    $object = $session->create( "Router::crossr oads" );
    $session->detach( );[/code]

    The errors that I am getting are:

    Name "main::obje ct" used only once: possible typo at ./routerpl.pl line 14.
    [8] Cant find domain 'INCHARGE' in broker 'localhost:426' , stopped at ./routerpl.pl line 5

    PLEASE HELP SOON
    Thanks
    Gaurav
    The first warning is about your line
    [code=perl]$object = $session->create( "Router::crossr oads" );[/code]
    because this is the only place in your script where "$object" is used. When warnings are turned on, perl alerts you to situations like this because there is usually a mistake involved when you create a variable but don't use it again.

    The second problem sent me to Google to find out about InCharge, which appears to have something to do with Cisco routers. Is the address 10.213.31.209 the computer that is running this script or is it the router? Do you know which it is supposed to be?

    Lines 5, 6 and 7 look very suspicious to me. 6 and 7 BOTH appear to be creating new sessions (each called $session). I don't know anything about the Cisco InCharge module, but that seems wrong. I also suspect that if you need both "->new" and "->init" that line 5 would more likely follow 6 or 7 than precede. Line 14 looks suspicious too.

    I just opened up the InCharge Perl Reference Guide and on page 27 (by the numbering at the bottom of the page) I see something resembling your code. It looks like you took ALL of the alternative ways of trying to open a session and plopped them all into a single script. Use only one of the forms.

    I understand that you say you are new to perl, but I'm afraid I can't just hand you a working script because I don't have access to a Cisco InCharge router to experiment with. It also appears that the script as it is does not actually do anything with the router. It just opens a session and then closes it. I would guess that you might start with something more like this:

    [code=perl]#!/usr/bin/perl
    use warnings;
    use strict;
    use lib '/opt/InCharge65/IP/smarts/perl/5.6.1/lib';
    use InCharge::sessi on;
    my $session = InCharge::sessi on->new(
    broker=>"10.213 .31.209:426",
    domain=>"IPVPN-APM2",
    username=>"admi n",
    password=>"chan geme",
    traceServer => 1
    );
    # do something with the router ???
    $session->detach( );[/code]

    where the comment "# do something with the router" indicates where you would actually do whatever work your script is intended to do in the way of setting your router.

    Good Luck,
    Paul

    Comment

    • gawasthi
      New Member
      • May 2007
      • 5

      #3
      Hi,
      You are spot on man. Thanks for the elaborate and quick reply.
      Using only "$session = InCharge::sessi on->new(...", I was able to do it.
      To clarify what I was doing, this script adds a router named crossroads into the repository of Incharge.
      I am truly awed by the detailed response you have given. Many thanks. Inspires me to help others :-)
      Gaurav

      Comment

      • prn
        Recognized Expert Contributor
        • Apr 2007
        • 254

        #4
        Originally posted by gawasthi
        Many thanks. Inspires me to help others :-)
        Gaurav
        Great! I'm happy I could help. And I do hope your inspiration keeps you around here and contributing. The more we all help others, the better off the world is.

        I hope to see you around.

        Best Regards,
        Paul

        Comment

        • KevinADC
          Recognized Expert Specialist
          • Jan 2007
          • 4092

          #5
          Originally posted by gawasthi
          Hi,
          I am truly awed by the detailed response you have given.
          Gaurav
          Me too. I doubt I would have taken the time to do all that foot work to try and answer his question.

          Comment

          Working...