var newvalue;
switch(value) {
  case "unkonwn":
    newvalue = 0;
    break;
  case "notpresent":
    newvalue = 1;
    break;
  case "down":
    newvalue = 2;
    break;
  case "lowerlayerdown":
    newvalue = 3;
    break;
  case "testing":
    newvalue = 4;
    break;
  case "dormant":
    newvalue = 5;
    break;
  case "up":
    newvalue = 6;
    break;  default:
    newvalue = "Problem parsing interface operstate in JS";
}
return newvalue;