Forum Discussion

Hamish's avatar
Hamish
Icon for Cirrocumulus rankCirrocumulus
Mar 12, 2010

Format of external (STring) class file

Does anyone know what the actual format of an external string class file should be for v10.1?

 

 

I'm trying to translate some code from v9 to v10.1... And dropping the deprecated findclass functions. But

 

 

 
 [class search -value $class equals $lookup] 
 

 

 

returns nothing... Investigating a bit I realised that the iControl script I use to upload the content(That works for a v9 external class) doesn't get anything automatic for the new key:=value syntax...

 

 

But I can't find how to do this... At the moment I've stopped trying to use the iControl, and am just trying to create a new external file class (Of type string), but having tried

 

 

 
 key:=some value 
 

 

 
 "key":="some value" 
 

 

 
 "key:=some value" 
 

 

 

and just in case the v10 description on the wiki was a bit mixed up I even tried

 

 

 
 class images {   
   "square.gif" := ""   
   "circle.gif" := "" 
 } 
 

 

 

and several other combinations, all I ever get is an error when trying to create the new class with invalid format in line 1...

 

 

What's the ACTUAL syntax required in the file itself? (I can't use an internal group, because the values are base64 encoded html pages and images... The format of

 

 

filename mimetype base64encodedcontent

 

 

where the filename is the key and the "mimetype base64encodedcontent" is the value

 

 

(On v9 it as easy. Just

 

 

 
 "filename mimetype base64encodedcontent", 
 "filename mimetype base64encodedcontent", 
 "filename mimetype base64encodedcontent" 
 

 

 

Is this supported on v10.1? I did see a posting between Aaron and Sparkie that indicated it wasn't in 10.0... But Aaron thought it was going to be in 10.1...

 

 

6 Replies

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    In fact if I just create an empty class (External) and try to add string/values using the example from the 'b class' manpage... It fails...

     
     [root@cdc-3-lb5-mgmt:Active] class  b class filter.pages { "AL" { "Alabama" } "AK" { "Alaska" } AZ { "Arizona" } "AR" { "Arkansas" } } 
     BIGpipe parsing error: 
        012e0017:3: The requested item (AL {) is invalid ( | show | list | help) for 'class ip item' 
     [root@cdc-3-lb5-mgmt:Active] class  
     

  • Hamish's avatar
    Hamish
    Icon for Cirrocumulus rankCirrocumulus
    And to answer my own question... it's a two part process... (Once the class is set up).

     

     

    You need to create the class, then

     

     

    1. Add the member

     

     

    b class filter.pages \"hamish.html\" add

     

     

    2. Add the value

     

     

    b class filter.pages { \"hamish.html\" {\"values\"}}

     

     

    3. Save the added member/value pairs

     

     

    b save

     

     

    The actual file format comes out as

     

     

    "key1" := "value",

     

    "key2" := "value",

     

     

    the comma on the end of the line (All including the last line) is significant...

     

     

    H
  • Cool deal. That seems to work for the external file as well:

     
      cat /var/class/my.strings.class 
     "key1" := "value", 
     "key2" := "value", 
     

     
      b class my.strings.class list 
     class my.strings.class { 
        type string 
        filename "/var/class/my.strings.class" 
        mode read 
        separator ":=" 
     } 
     

    Thanks for figuring this out, Hamish.

    Aaron
  • I am a newbie to iRule. Can any one please point out the steps to create a class in BIG-IP. For example to create a class which calls an external file

     

     

    b class my.strings.class list

     

    class my.strings.class {

     

    type string

     

    filename "/var/class/my.strings.class"

     

    mode read

     

    separator ":=" }

     

  • Posted By poornima on 01/19/2011 08:26 AM

     

    I am a newbie to iRule. Can any one please point out the steps to create a class in BIG-IP. For example to create a class which calls an external file

     

     

    b class my.strings.class list

     

    class my.strings.class {

     

    type string

     

    filename "/var/class/my.strings.class"

     

    mode read

     

    separator ":=" }

     

     

    Are you trying to create an internal or external class? Also, through the GUI or command line?