Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Warning
titleALERT
This macro has been removed by LF IT, a workaround is in progress.

How to use:

  1. Click on the "Generate ID" button and wait for an alert the requirement to pop show up with in the Requirement ID field.
  2. The Requirement ID will be passed into the "Requirement ID" field in the form.
  3. Fill out and edit the form as needed.
    1. Please fill out all fields, if you are not sure what to put, please refer to: VNFRQTS Requirement and Documentation Standards
  4. Click on the "Generate RST" button.
  5. There will be a new section added under with the requirement properly formatted into RST which can be copied and pasted to be used as needed.
    1. Moving forward, you can do one of two things with the generated RST:
      1. Copy and paste this into the JIRA ticket associated in: https://jira.onap.org/projects/VNFRQTS/issues/
      2. Copy and paste this into the appropriate Chapter and Section in the RST document cloned from: https://gerrit.onap.org/r/#/admin/projects/vnfrqts/requirements and submit a gerrit review.
        1. Refer To understand how to do this, please refer to VNFRQTS How to Contribute for more information on how to Contribute.to set up the prerequisites for all necessary tools to make changes.
        2. NOTE: This tool ONLY generates the RST, it does not automatically add it to JIRA or into Gerrit, those will have to be done manually. It is important to understand how to make changes in Git/Gerrit before using this tool so please refer to: VNFRQTS How to Contribute
          1. If you still have any questions or concerns please contact: Hagop Bozawglanian
  6. video walkthrough. 


Expand


HTML

<html>

  <body>

    <button style="background-color: #008CBA; color: white; border: 2px solid black; width: 100%; font-size: 24px;" id="generate">Generate ID</button>

    <form id="req">
      <div id="sections">
        <div class="section">
          <fieldset>
            <p>
              <label for="id">Requirement ID:</label>
              <input style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="id" id="id" value="" type="text" readonly class="required" />
            </p>
            <p>
              <label for="target">Target:</label>
              <select onchange="buildReq(target)" style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="target" id="target" class="required">
               <option value="" hidden>Select Target</option>
               <option value="VNF">VNF</option>
               <option value="PNF">PNF</option>
               <option value="VNF or PNF">VNF or PNF</option>
               <option value="VNF PROVIDER">VNF PROVIDER</option>
               <option value="PNF PROVIDER">PNF PROVIDER</option>
               <option value="VNF or PNF PROVIDER">VNF or PNF PROVIDER</option>
               <option value="VNF HEAT PACKAGE">VNF HEAT PACKAGE</option>
               <option value="VNF CSAR PACKAGE">VNF CSAR PACKAGE</option>
               <option value="PNF CSAR PACKAGE">PNF CSAR PACKAGE</option>
               <option value="VNF or PNF CSAR PACKAGE">VNF or PNF CSAR PACKAGE</option>
               <option value="VNF DOCUMENTATION PACKAGE">VNF DOCUMENTATION PACKAGE</option>
               <option value="PNF DOCUMENTATION PACKAGE">PNF DOCUMENTATION PACKAGE</option>
               <option value="VNF or PNF DOCUMENTATION PACKAGE">VNF or PNF DOCUMENTATION PACKAGE</option>
              </select>
            </p>
            <p>
              <label for="keyword">Keyword:</label>
              <select onchange="buildReq(keyword)" style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="keyword" id="keyword" class="required">
               <option value="" hidden>Select Keyword</option>
       
HTML
<html> <body> <button style="background-color: #008CBA; color: white; border: 2px solid black; width: 100%; font-size: 24px;" id="generate">Generate ID</button> <form id="req"> <div id="sections">
        
<div
<option 
class
value="
section">
**MUST**">MUST</option>
          
<fieldset>
     <option value="**MUST NOT**">MUST NOT</option>
    
<legend>Requirement</legend>
           
<p>
<option value="**SHOULD**">SHOULD</option>
              
<label
 <option 
for
value="
id">Requirement ID:</label>
**SHOULD NOT**">SHOULD NOT</option>
              
<input
 <option 
style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="id" id="id" value="" type="text" readonly/>
value="**MAY**">MAY</option>
              </select>
            </p>
            <p>
              <label for="
keyword
introduced"
>Keyword
>Introduced:</label>
              <select style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="
keyword
introduced">
               
<option value="
MUST
amsterdam"
>MUST<
>amsterdam</option>
               
<option value="
MUST NOT">MUST NOT<
beijing">beijing</option>
               <option value="
SHOULD
casablanca"
>SHOULD<
>casablanca</option>
               
<option value="dublin"
SHOULD
 
NOT">SHOULD NOT<
selected="selected">dublin</option>
               
<option value="
MAY">MAY<
el alto">el alto</option>
              </select>
            </p>
            <p>
              <label for="
target
impacts"
>Target
>Impacts*:</label>
              <select style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="
target">
impacts" size="10" multiple>
               
<option value="
VNF
AAI"
>VNF<
>AAI</option>
               
<option value="
VNFC
AAF"
>VNFC<
>AAF</option>
               
<option value="
VNF PROVIDER">VNF PROVIDER<
APPC">APPC</option>
               
<option value="
VNF HEAT ORCHESTRATION TEMPLATE">VNF HEAT ORCHESTRATION TEMPLATE<
CLAMP">CLAMP</option>
               <option value="
VNF PACKAGE">VNF PACKAGE<
CCSDK">CCSDK</option>
               
<option value="
PNF
DCAE"
>PNF<
>DCAE</option>
               
<option value="
VNF or PNF">VNF or PNF<
Documentation">Documentation</option>
              
</select>
 
</p>
<option value="DCAE">DCAE</option>
            
<p>
   <option value="External 
API">External API</option>
       
<label for="introduced">Introduced:</label>
        <option value="Holmes">Holmes</option>
     
<select
 
style="width:
 
100%;
 
margin:
 
8px
 
0;
 
box-sizing:
 
border-box;
 
padding:
 
12px
 
20px;"
<option 
name
value="
introduced
Integration"
>
>Integration</option>
               
<option value="
amsterdam
Logging"
>amsterdam<
>Logging</option>
               
<option value="
beijing">beijing<
Micro Bus">Micro Bus</option>
               
<option value="
casablanca
Modeling"
>casablanca<
>Modeling</option>
               
<option value="
dublin
Multi VIM"
selected="selected">dublin<
>Multi VIM</option>
               <option value="
el alto">el alto<
Music">Music</option>
               
</select>
<option value="CLI">CLI</option>
            
</p>
   <option value="OOM">OOM</option>
        
<p>
       
<label for
<option value="
impacts">Impacts*:</label>
OOF">OOF</option>
          
<select style="width: 100%; margin: 8px 0;
 
box-sizing:
 
border-box;
 
padding:
 
12px
 
20px;"
<option 
name
value="
impacts"
Usecase 
size=
UI"
10" multiple>
>Usecase UI</option>
               
<option value="
AAI
Policy"
>AAI<
>Policy</option>
               <option value="
AAF
Portal"
>AAF<
>Portal</option>
               
<option value="
APPC
SDNC"
>APPC<
>SDNC</option>
               
<option value="
CLAMP
SDC"
>CLAMP<
>SDC</option>
               
<option value="
CCSDK
SO"
>CCSDK<
>SO</option>
               
<option value="
DCAE
VFC"
>DCAE<
>VFC</option>
               
<option value="
Documentation
VID"
>Documentation<
>VID</option>
               
<option value="
DCAE
VNFSDK"
>DCAE<
>VNFSDK</option>
               
<option value="
ExternalAPI
VNFRQTS"
>External API<
>VNFRQTS</option>
               <option value="
Holmes
VVP"
>Holmes<
>VVP</option>
              </select>
           
<option value="Integration">Integration</option>
 </p>
            <p>
    
<option value="Logging">Logging</option>
          <b>*Hold down the Ctrl (windows) / Command (Mac) 
<option value="MicroBus">Micro Bus</option>
button to select multiple options for impacts.</b>
            
<option value="Modeling">Modeling</option>
</p>
            
<option value="MultiVIM">Multi VIM</option>
<p>
              <label 
<option value
for="
Music">Music</option>
validation_mode">Validation Mode:</label>
              <select 
<option value
style="
CLI">CLI</option> <option value="OOM">OOM</option>
width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="validation_mode">
               
<option value="
OOF">OOF<
" selected disabled hidden>Select Validation Mode</option>
               
<option value="
UsecaseUI
static"
>Usecase UI<
>static</option>
               
<option value="
Policy
none"
>Policy<
>none</option>
              
<option value="Portal">Portal</option>
</select>
            
<option value="SDNC">SDNC</option>
</p>
            
<option value="SDC">SDC</option>
<p>
              <label 
<option value
for="
SO">SO</option>
requirementText">Requirement Text:*</label>
              <textarea 
<option value
style="
VFC">VFC</option> <option value="VID">VID</option>
width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" id="requirementText" rows="10" cols="30" class="required" value="" type="text"></textarea>
            </p>
    
<option
 
value="VNFSDK">VNFSDK</option>
       <p>
         
<option
 
value="VNFRQTS">VNFRQTS</option>
    <b>*Make sure to add keyword entered in KEYWORD field in the requirement 
<option value="VVP">VVP</option>
in CAPS.</b>
            
</
select>
p>
          </
p>
fieldset>
        </div>
      
<p>
</div>
    </form>
    <button style="background-color: #008CBA; color: white; border: 
*Hold
2px 
down
solid 
the
black; 
Ctrl (windows) / Command (Mac) button to select multiple options for impacts. </p> <p>
width: 100%; font-size: 24px;" onclick="formDataToObject(document.getElementById('req'))">Convert to RST</button>
    <textarea style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" rows="10" cols="30" id="formatted" readonly>
Formatted RST will Show here.
</textarea>

    <script>
      //define template
      var template 
<label for="validation_mode">Validation Mode:</label>
= $('#sections .section:first').clone();
      //define counter
      var 
<select
sectionsCount 
style
=
"width:
 
100%
1;
 
margin:
    
8px
 
0; box-sizing: border-box; padding: 12px 20px;" name="validation_mode">
var url = "https://wiki.onap.org/download/attachments/60887371/needs.json?api=v2"
      $('body').on('click', '#generate', function(e) {
       
<option value="static">static</option>
 myFunction();
      });

      function 
<option value="none">none</option>
myFunction() {
        get(url).then(JSON.parse).then(function(data) {
     
</select>
     console.log("It worked!", data);
     
</p>
     return data;
      
<p>
  }).catch(function(err) {
          // 
<label for="requirementText">Requirement Text:*</label>
Instead, this happens:
          console.log("It failed!", err);
     
<textarea
  
style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="requirementText" id="requirementText" rows="10" cols="30" value="" type="text">Enter Requirement text.</textarea>
 }).then(function(data) {
          var parsedData = parseIDs(data);
          var finalIDs = 
</p>
createIDs(1, parsedData);
          console.log(finalIDs);
     
<p>
     addSection(finalIDs);
        
*Make sure to surround your keyword with '**', for example, **MUST**.
})
      }

      function get(url) {
        // Return a new 
</p>
promise.
    
</fieldset>
    return new Promise(function(resolve, reject) 
</div>
{
      
</div>
    
<
//
form>
 Do the usual 
<button style="background-color: #008CBA; color: white; border: 2px solid black; width: 100%; font-size: 24px;" onclick="formDataToObject(document.getElementById('req'))">Convert to RST</button>
XHR stuff
          var req = new XMLHttpRequest();
    
<textarea
 
style="width:
 
100%;
 
margin:
 
8px
 
0; box-sizing: border-box; padding: 12px 20px;" rows="10" cols="30" id="demo" readonly> Formatted RST will Show here. </textarea> <script>
 req.open('GET', url);
          req.onload = function() {
            //
define template var template = $('#sections .section:first').clone();
 This is called even on 404 etc
            //
define counter
 so check the status
       
var
 
sectionsCount
 
=
 
1;
  if (req.status == 200) 
var
{
  
url
 
=
 
"https://wiki.onap.org/download/attachments/60887371/needs.json?api=v2"
      
$('body').on('click',
 
'#generate',
 
function(e)
 
{
 // Resolve the promise with the response 
myFunction();
text
      
});
      
$('body').on('click',
 
'#convert',
 
function
resolve(
e) {
req.response);
        
convert();
    } else 
});
{
      
function
 
myFunction()
 
{
      // 
get(url).then(JSON.parse).then(function(data) {
Otherwise reject with the status text
           
console.log("It worked!", data);
   // which will hopefully be a meaningful error
     
return
 
data;
        
}).catch(function(err) {
reject(Error(req.statusText));
          
//
 
Instead, this happens:
 }
        
console.log("It failed!", err)
  };
          // 
}).then(function(data) {
Handle network errors
          
var
req.onerror 
parsedData
= 
parseIDs
function(
data
)
;
 {
          
var
 
finalIDs = createIDs(1, parsedData
 reject(Error("Network Error"));
          
console.log(finalIDs)
};
          
alert(finalIDs);
// Make the request
          
addSection
req.send(
finalIDs
);
        });
      }

      function 
get
parseIDs(
url
jsonText) {
        
//
var 
Return
result 
a
= new 
promise.
Set();
        
return
var 
new Promise(function(resolve, reject) {
version = jsonText.current_version;
        result.add(Object.keys(jsonText["versions"][version]["needs"]));
   
//
 
Do
 
the
 
usual
 
XHR stuff
 console.log(result);
        return result;
  
var
 
req
 
=
 
new XMLHttpRequest();
 }

      
req.open('GET', url);
function createIDs(numberOfIDs, parsedData) {
        var addedIDs = [];
  
req.onload
 
=
 
function()
 
{
   for (x = 0; x < numberOfIDs; x++) {
 
//
 
This
 
is
 
called
 
even
 
on
 
404
 
etc
  var new_id = "";
       
//
 
so
 
check
 
the
do 
status
{
            
if (req.status == 200) {
new_id = (Math.floor(Math.random() * 999999));
            if 
// Resolve the promise with the response text
(new_id < 100000) {
              new_id = ('000000' 
resolve(req.response
+ new_id).slice(-6);
            }
else {

            new_id 
// Otherwise reject with the status text
= ("R-" + new_id);
          
// which will hopefully be a meaningful error
}
          while 
reject(Error(req.statusText
(parsedData.has(new_id));
          addedIDs[x] 
}
= new_id;
        
}
;

        
// Handle network errors
return addedIDs;
      }

    
req.onerror
 
=
 function addSection(finalIDs) {
        document.getElementById('id').value = finalIDs;
   
reject(Error("Network
 
Error"));
  }

      function 
};
formDataToObject(elForm) {
        
//if 
Make the request
(!elForm instanceof Element) return;
        var fields = 
req
elForm.
send();
querySelectorAll('input, select, textarea'),
        
});
  o = {};
  
}
      
function
for 
parseIDs
(
jsonText)
var 
{
i = 0, imax = fields.length; i < 
var result = new Set();
imax; ++i) {
          var 
version
field = 
jsonText.current_version;
fields[i],
        
result.add(Object.keys(jsonText["versions"][version]["needs"]));
    sKey = field.name || 
console.log(result)
field.id;
        
return
 
result;
 if (field.type === 'button' 
} function createIDs(numberOfIDs, parsedData) {
|| field.type === 'image' || field.type === 'submit' || !sKey) continue;
        
var
  
addedIDs = [];
switch (field.type) {
        
for
 
(x
 
=
 
0;
 
x < numberOfIDs; x++) {
case 'checkbox':
             
var new_id
 o[sKey] = 
""
+field.checked;
          
do
 
{
   break;
         
new_id
 
=
 
(Math.floor(Math.random() * 999999));
 case 'radio':
              if (
new_id < 100000) {
o[sKey] === undefined) o[sKey] = '';
              
new_id = ('000000' + new_id).slice(-6);
if (field.checked) o[sKey] = field.value;
              
}
break;
            
new_id = ("R-" + new_id);
case 'select-multiple':
        
}
      var a 
while (parsedData.has(new_id))
= [];
          
addedIDs[x]
 
=
 
new_id;
  
} return addedIDs;
for (var j = 0, jmax = field.options.length; j < jmax; ++j) {
    
}
      
function
 
addSection(finalIDs)
 
{
    if 
document.getElementById('id').value = finalIDs;
(field.options[j].selected) a.push(field.options[j].value);
        
}
      
function formDataToObject(elForm) {
}
            
//if
 
(!elForm instanceof Element) return
 o[sKey] = a;
        
var
  
fields
 
=
 
elForm.querySelectorAll('input,
 
select, textarea'),
 break;
          
o
 
=
 
{};
default:
        
for
  
(var
 
i
 
=
 
0, imax
 o[sKey] = 
fields
field.
length
value;
 
i
 
<
 
imax;
 
++i)
 
{
     }
     
var
 
field
 
=
 
fields[i],
}
        //formcheck();
    
sKey
 
=
 
field.name
 
|| field.id
 buildRST(o);
        return 
if (field.type === 'button' || field.type === 'image' || field.type === 'submit' || !sKey) continue;
o;
      }

      function buildRST(o) {
        var rst 
switch
= 
(field
"..
type) {
 req::\n";
        var arrayOfLines 
case 'checkbox':
= $('#requirementText').val().split('\n');
        for (y in o) {
      
o[sKey]
 
=
 
+field.checked;
  if (y == "requirementText") {
        
break;
    for (z in arrayOfLines) {
    
case
 
'radio':
         rst += "\n   
if
 
(o[sKey] === undefined) o[sKey] = ''
" + arrayOfLines[z];
            
if (field.checked) o[sKey] = field.value;
}
          } else {
 
break;
           rst 
case 'select-multiple':
+= "    :" + y + ": " + o[y] + 
var a = [];
"\n";
          }
        }
 
for
 
(var
 
j
 
=
 
0,
 
jmax
 
=
 
field.options.length; j < jmax; ++j) {
document.getElementById("formatted").innerHTML = rst;
      }

      function formcheck() {
        var l 
if
= $(
field.options[j].selected) a.push(field.options[j].value)
".required").length;
        var result 
}
= [];
        for (i = 0; i 
o[sKey] = a;
< l; i++) {
          //Push each element to the 
break;
array
          if 
default:
($('.required').eq(i).val() == "") {
            
o[sKey] = field.value
result.push($('.required')[i].name);
          }
        }
        if 
buildRST(o);
(result.length != 0) {
     
return
 
o;
    
} function buildRST(o) {
alert("Please enter a value in: " + result);
        
var
}
 
rst
 
=
 
"..req::\n\n";
   }

     
var
 
arrayOfLines
function 
= $('#requirementText').val().split('\n')
buildReq(fieldClicked) {
        
for
var 
(y in o) {
addedTarget, addedKeword;
        var text 
if
= 
(y == "requirementText") {
$('#requirementText');
        switch (fieldClicked.id) {
     
for
 
(z
 
in
 
arrayOfLines)
 
{
 case 'target':
            
rst
addedTarget 
+
= 
"\n
'The ' + fieldClicked.value 
"
+ 
+ arrayOfLines[z]
' ';
           
}
 text.val(text.val() + addedTarget);
          
}
 
else
 
{
break;
          case 'keyword':
 
rst
 
+=
 
"
    
:"
 
+
 
y
 
+
 
": " + o[y] + "\n"
 text.val(text.val() + fieldClicked.value);
          
}
  
}
break;
        
document.getElementById("demo").innerHTML = rst;
}
      }

    </script>
  </body>

</html>