1 Reply Latest reply on Aug 6, 2019 12:18 AM by iiliev

    Nested Switch Issue with vRO

    mulliganesx Novice

      Does vRO work with nested switch statements for XaaS?   vRO is not differentiating between the case for "osType"   It is either or.  My current workaround is to hardcode 'osversion' to a particular "ValueSet.***" which works but is not extensible since I am locked to that cluster.  I am still learning, and looking for insight on how I can make the below code work.. Or for assistance to convert it into something extensible..

       

      Thanks

       

       

      // Nested switch
      switch(osType){
      // code to be executed if osVersion = Windows2012R2
                   case "Windows2012R2":
         switch(reservationPolicy){
         // NX Datacenter
      case 'NX-Cluster-01': 
              osversion = "ValueSet.Windows2012R2Standard";
          break;
              case "NX-Cluster-02":
              osversion = "ValueSet.Windows2012R2Standard01";
          break;
      case "NX-Cluster-03": 
              osversion = "ValueSet.Windows2012R2Standard02";
          break;
              case "NX-Cluster-04":
              osversion = "ValueSet.Windows2012R2Standard";
          break;
              case "NX-Cluster-05":
              osversion = "ValueSet.Windows2012R2Standard";
          break;
              }
      // code to be executed if osVersion = Windows2016
           case "Windows2016":
                 switch(reservationPolicy){
         //AT Datacenter
      case "AT-Cluster-01": 
              osversion = "ValueSet.Windows2016Standard";
          break;
              case "AT-Cluster-01":
              osversion = "ValueSet.Windows2016Standard01";
          break;
      case "AT-Cluster-01": 
              osversion = "ValueSet.Windows2016Standard02";
          break;
              case "AT-Cluster-01":
              osversion = "ValueSet.Windows2016Standard";
          break;      
              case "AT-Cluster-01":
              osversion = "ValueSet.Windows2016Standard";
          break;
              }
        }
      
        • 1. Re: Nested Switch Issue with vRO
          iiliev Champion
          Community WarriorsVMware Employees

          Hi,

           

          This question was brought to our internal channels yesterday, and it seems the code doesn't work simply because the outer switch lacks break statements (it was Brandon Saxe who spotted this).

           

          So, to make the code work, you need to insert break; between lines 23-24 of your code (and optionally between lines 42-43).

          1 person found this helpful