Announcement

Collapse
No announcement yet.

XML Import question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML Import question

    I have this XML import running within my main function...
    "<configgroup name = \"interface\" instance = \"eth0\">" \
    "<configitem name = \"bootp\">" \
    "<value>disable</value>" \
    "</configitem>" \
    "<configitem name = \"dhcp\">" \
    "<value>disable</value>" \
    "</configitem>" \
    "<configitem name = \"ip address\">" \
    "<value>192.168.1.250</value>" \
    "</configitem>" \
    "<configitem name = \"default gateway\">" \
    "<value>&amp;#60;None&amp;#62;</value>" \
    "</configitem>" \
    "<configitem name = \"hostname\">" \
    "<value></value>" \
    "</configitem>" \
    "<configitem name = \"domain\">" \
    "<value></value>" \
    "</configitem>" \
    "<configitem name = \"dhcp client id\">" \
    "<value></value>" \
    "</configitem>" \
    "<configitem name = \"primary dns\">" \
    "<value>&amp;#60;None&amp;#62;</value>" \
    "</configitem>" \
    "<configitem name = \"secondary dns\">" \
    "<value>&amp;#60;None&amp;#62;</value>" \
    "</configitem>" \
    "</configgroup>" \
    When I upload this to the matchport_ar, I cannot access the matchport from the Device Installer, my FTP server does not work, and my html pages do not load. However, if I comment this out, it runs fine.

    Also, everything comes up running if I go to the serial interface, reboot while holding down the "!" character, type xyz when it echoes back my "!" and then exit the command mode.

    help?
    Last edited by deanl; 02-11-2009, 02:59 PM.

  • #2
    Configuration check

    Your XML looks reasonable enough.

    The way I would debug it would be to connect up to serial port 1 from my PC, run TeraTerm at default 9600 bps into it, hold down the shift and "!" key, cycle power on the MatchPort-AR, then when I see the first "!" come to TeraTerm, type "xyz" to gain access via the "back door". From here I would use the CLI to inspect the configuration. If that looks good, next I would Telnet to the device to access the CLI again, proving that networking works. At this point your custom code has not yet been initialized. After you exit the CLI from the "back door", your custom code initialization will begin. In this way, you can quickly assess what is happening.

    Comment


    • #3
      Your XML looks reasonable enough.

      The way I would debug it would be to connect up to serial port 1 from my PC, run TeraTerm at default 9600 bps into it, hold down the shift and "!" key, cycle power on the MatchPort-AR, then when I see the first "!" come to TeraTerm, type "xyz" to gain access via the "back door". From here I would use the CLI to inspect the configuration. If that looks good, next I would Telnet to the device to access the CLI again, proving that networking works. At this point your custom code has not yet been initialized. After you exit the CLI from the "back door", your custom code initialization will begin. In this way, you can quickly assess what is happening.
      The configuration seems to get loaded like it should. It's just that something in there is holding the device up. Even if I put that snippet in the xmlconfig.c sample, it does the same exact thing. I get XML errors when it loads the first time, but after accessing it through the CLI, and then exiting, it shows "Done Processing XML" just like it should

      Comment


      • #4
        XML errors?

        You say, "I get XML errors when it loads the first time". What are the XML errors? They are probably telling you what you need to know.

        Comment


        • #5
          From this piece of code:
          if(! XMLImportFromStream(&bufferStream.inStream, blinkErrorHandler, NULL))
          {
          TLOG(TLOG_SEVERITY_DEBUG, "XML not processed!");
          }
          Once you go to the CLI, it says XML PROCESSED.

          If i remove that piece, and let it load the rest of it all, it works just fine. However, this is crucial to my requirements.

          Comment


          • #6
            What???

            From this piece of code:
            Quote:if(! XMLImportFromStream(&bufferStream.inStream, blinkErrorHandler, NULL))
            {
            TLOG(TLOG_SEVERITY_DEBUG, "XML not processed!");
            }

            Once you go to the CLI, it says XML PROCESSED.

            If i remove that piece, and let it load the rest of it all, it works just fine. However, this is crucial to my requirements.
            Now I am more confused. Your code snippet has a TLOG that says, "XML not processed". You say that when you enter the CLI it says "XML PROCESSED".

            Was this your typo, and you meant to say that it prints out your "XML not processed" TLOG?

            If you are having any XML import error, it will be given to "blinkErrorHandler". What does it do with the message? That is what you need to look at.

            Comment


            • #7
              Sorry about that.

              If I open a CLI session (with hyperterminal or whatever) upon the first boot of loading the new firmware, I get the error. If I use the backdoor, and then exit out of the backdoor via 'exit' command, it says XML processed.

              I'm not sure the XML is actually the problem. I have a feeling that it's something else, but I can't quite put my finger on it. It sure is frustrating though.

              Comment


              • #8
                What error?

                If I open a CLI session (with hyperterminal or whatever) upon the first boot of loading the new firmware, I get the error.
                What is the error? You need to read the error message!

                Comment


                • #9
                  Here's the real issue. There are no more XML errors...

                  When I load my custom firmware via the "recover firmware utility," then reboot the unit, the device cannot be found via the Device Installer. Also, I cannot connect to the device through the web interface, telnet, or FTP. However, if I use the backdoor "!" command, I can get to it, obviously. Once I exit out of the CLI, everything starts running. Telnet, FTP, HTTP, they all work. However, reloading the firmware seems to break the device.

                  Am I doing something wrong?

                  Comment


                  • #10
                    Reloading firmware

                    Are you saying that the problem happens only the first time after you reload firmware?

                    More specifically, once you get it to work by entering the back door and exiting, what happens if you just power cycle the device?

                    Comment


                    • #11
                      If I power cycle the device, it breaks again. Go back through CLI, and it works again.

                      Comment


                      • #12
                        Debugging SDK custom code

                        Good! Now we have a handle on what is happening:

                        When you access the device after power up using the back door method, your SDK initialization code has not yet been called. Later, when you exit the CLI, your SDK initialization code is called and at that point it works fine.

                        Otherwise, if you just let it boot up normally, you SDK initialization code is called immediately after the Evolution initialization.

                        What this tells us is that your SDK code is behaving in some way that interferes with the network from coming up.

                        You could play with your SDK code in an attempt to identify specifically what it is doing that causes trouble.

                        Or, for us to identify what is getting stuck in the network initialization, we would have many more questions for you. For starters:
                        Is the device coming up with DHCP when you successfully use the back door? If not, what does the network configuration look like?
                        Is your SDK code attempting to load XML configuration that changes any network settings? Some of them require a reboot to take effect.

                        Comment


                        • #13
                          Regarding my sdk code, there are two things going on...

                          1. import XML code to the device. This appears to work normally because all of the data and configuration information is there when I look at it through the CLI.

                          2. run a thread, every second, that utilizes the following:

                          // Read in total size of filesystem used
                          memzero(&xmlReadValueSpec, sizeof(xmlReadValueSpec));
                          xmlReadValueSpec.type = XML_READ_VALUE_TYPE__STATUS;
                          xmlReadValueSpec.groupName = "filesystem";
                          xmlReadValueSpec.itemName = "filesystem";
                          xmlReadValueSpec.optValueName = "used total";

                          FSTotalUsed_ptr = XMLReadValue_malloc(&xmlReadValueSpec);
                          //snprintf(outBuffer, sizeof(outBuffer), "used char: %s", FSTotalUsed_ptr);
                          //TLOG(TLOG_SEVERITY_DEBUG, outBuffer);

                          FSTotalUsedInt = atoi(FSTotalUsed_ptr);
                          For now, the thread is turned off and the only thing running is the XML.

                          int SDKMain(struct command_line *commandLine, struct http_server *httpServer)
                          {
                          struct input_stream_with_const_char_ptr bufferStream;

                          char *xmlCPConfig = "<?xml version=\"1.0\" standalone=\"yes\"?>" \
                          "<configrecord>" \
                          "<configgroup name = \"cp group\" instance = \"PinCP1\">" \
                          "<configitem name = \"cp\">" \
                          "<value name = \"cp\">1</value>" \
                          "<value name = \"bit\">0</value>" \
                          "<value name = \"type\">output</value>" \
                          "<value name = \"assert low\">disable</value>" \
                          "</configitem>" \
                          "<configitem name = \"state\">" \
                          "<value>enable</value>" \
                          "</configitem>" \
                          "</configgroup>" \
                          "<configgroup name = \"cp group\" instance = \"PinCP2\">" \
                          "<configitem name = \"cp\">" \
                          "<value name = \"cp\">2</value>" \
                          "<value name = \"bit\">0</value>" \
                          "<value name = \"type\">output</value>" \
                          "<value name = \"assert low\">disable</value>" \
                          "</configitem>" \
                          "<configitem name = \"state\">" \
                          "<value>enable</value>" \
                          "</configitem>" \
                          "</configgroup>" \
                          "<configgroup name = \"cp group\" instance = \"PinCP6\">" \
                          "<configitem name = \"cp\">" \
                          "<value name = \"cp\">6</value>" \
                          "<value name = \"bit\">0</value>" \
                          "<value name = \"type\">output</value>" \
                          "<value name = \"assert low\">disable</value>" \
                          "</configitem>" \
                          "<configitem name = \"state\">" \
                          "<value>enable</value>" \
                          "</configitem>" \
                          "</configgroup>" \
                          "<configgroup name = \"cp group\" instance = \"PinCP7\">" \
                          "<configitem name = \"cp\">" \
                          "<value name = \"cp\">7</value>" \
                          "<value name = \"bit\">0</value>" \
                          "<value name = \"type\">output</value>" \
                          "<value name = \"assert low\">disable</value>" \
                          "</configitem>" \
                          "<configitem name = \"state\">" \
                          "<value>enable</value>" \
                          "</configitem>" \
                          "</configgroup>" \

                          "<configgroup name = \"ftp server\">" \
                          "<configitem name = \"state\">" \
                          "<value>enable</value>" \
                          "</configitem>" \
                          "<configitem name = \"admin username\">" \
                          "<value>admin</value>" \
                          "</configitem>" \
                          "<configitem name = \"admin password\">" \
                          "<value>redacted</value>" \
                          "</configitem>" \
                          "</configgroup>" \

                          "<configgroup name = \"snmp\">" \
                          "<configitem name = \"state\">" \
                          "<value>enable</value>" \
                          "</configitem>" \
                          "<configitem name = \"read community\">" \
                          "<value>public</value>" \
                          "</configitem>" \
                          "<configitem name = \"write community\">" \
                          "<value>private</value>" \
                          "</configitem>" \
                          "<configitem name = \"system name\">" \
                          "<value>matchport</value>" \
                          "</configitem>" \
                          "<configitem name = \"system contact\">" \
                          "<value></value>" \
                          "</configitem>" \
                          "<configitem name = \"system description\">" \
                          "<value>redacted</value>" \
                          "</configitem>" \
                          "<configitem name = \"system location\">" \
                          "<value></value>" \
                          "</configitem>" \
                          "<configitem name = \"traps\">" \
                          "<value name = \"state\">enable</value>" \
                          "<value name = \"primary destination\"></value>" \
                          "<value name = \"secondary destination\"></value>" \
                          "</configitem>" \
                          "</configgroup>" \

                          "<configgroup name = \"http authentication uri\" instance = \"/\">" \
                          "<configitem name = \"user delete\">" \
                          "<value name = \"name\"></value>" \
                          "</configitem>" \
                          "<configitem name = \"realm\">" \
                          "<value>config</value>" \
                          "</configitem>" \
                          "<configitem name = \"type\">" \
                          "<value>Digest</value>" \
                          "</configitem>" \
                          "<configitem name = \"user\" instance = \"admin\">" \
                          "<value name = \"password\">redacted</value>" \
                          "</configitem>" \
                          "</configgroup>" \
                          "<configgroup name = \"interface\" instance = \"eth0\">" \
                          "<configitem name = \"bootp\">" \
                          "<value>disable</value>" \
                          "</configitem>" \
                          "<configitem name = \"dhcp\">" \
                          "<value>disable</value>" \
                          "</configitem>" \
                          "<configitem name = \"ip address\">" \
                          "<value>192.168.1.250</value>" \
                          "</configitem>" \
                          "<configitem name = \"default gateway\">" \
                          "<value></value>" \
                          "</configitem>" \
                          "<configitem name = \"hostname\">" \
                          "<value></value>" \
                          "</configitem>" \
                          "<configitem name = \"domain\">" \
                          "<value></value>" \
                          "</configitem>" \
                          "<configitem name = \"dhcp client id\">" \
                          "<value></value>" \
                          "</configitem>" \
                          "<configitem name = \"primary dns\">" \
                          "<value></value>" \
                          "</configitem>" \
                          "<configitem name = \"secondary dns\">" \
                          "<value></value>" \
                          "</configitem>" \
                          "</configgroup>" \
                          "</configrecord>";

                          (void)commandLine; /* To avoid compiler warning for unused variables */
                          (void)httpServer; /* To avoid compiler warning for unused variables */
                          It didn't paste real well, but hopefully you can read it.

                          Thanks for the help so far.

                          Comment


                          • #14
                            SCook,

                            Is it possible that I need to split the XML into more than one xmlCPConfig char? I'm really at a loss here.

                            Comment


                            • #15
                              Dean, you might consider moving that xmlCPConfig assignment statement off into global space - or put it in a file and read it. That one statement is eating up about 4KB of stack space.

                              Comment

                              Working...
                              X