Coder Social home page Coder Social logo

f5devcentral / f5-tmsh2iapp Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 12.0 281 KB

tmsh2iapp is an iApp generator using existing configurations as a template. The resulting iApps are fully parametrizable. It also generates Ansible playbooks & roles, Heat templates, iWorkflow JSON files and Kubernetes/Openshift Config Maps to deploy them

License: Apache License 2.0

Perl 100.00%

f5-tmsh2iapp's People

Contributors

alonsocamaro avatar alonsocamaro-test avatar alonsocamaro-test2 avatar alonsocamaro-test4 avatar colin-stubbs avatar f5-rahm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

f5-tmsh2iapp's Issues

RFE: iApp deployment within partition with non-default route domain

tmsh2iapp's most recent version 20171013.2 (commit 2127b835a937ea88a914745bb820e6c7c8d0f2a2) doesn't handle deployment scenarios within partition with a non-default (non-zero) route domain well.

This is a combination of BIG-IP behaviour and iApp behaviour. If using iWorkflow 2.3.0 with multi-tenancy enabled you WILL run into this issue if trying to use tmsh2iapp to generate iApp templates for import to iWorkflow.

e.g. if deploying within partition TENANT that has non-default route domain ID 123, with a pool member address of 203.0.113.4:80 it will try to create a node named "203.0.113.4", if no node yet exists in the partition the node will be created successfully and BIG-IP will automatically append %123 to it.

If an existing node for 203.0.113.4 has already been created BIG-IP will think of the node as 203.0.113.4%123 and deployment of the iApp will error as it a node named 203.0.113.4%123 with address 203.0.113.4%123 already exists YET the iApp is telling BIG-IP to create a node named 203.0.113.4 with address 203.0.113.4%123 ... the append of %123 by BIG-IP is implicit given the context of being within a partition with non-default route domain.

NOTE: The iApp it creates will work in the above situation with non-zero route domains provided the user understands that the need to postfix %N route domain identifiers to pool member addresses.

However; assuming the user will remember to do that, or that a third party system leveraging the API will know to postfix a route domain identifier that it may know nothing about, is dumb.

A better approach to this is to have the generated iApp determine the partition, then determine the default route domain for the partition, and if it is a non-zero route domain postfix %N to the node address.

This can be done with the following the iApp implementation code, the following as an example shell for implementation section within iApp when pm__pool_name is used.

puts "Starting iApp $tmsh::app_name.app generated with tmsh2iapp version 20171013.2"

set partition "/[lindex [split [tmsh::pwd] /] 1]"
set partition_name "[lindex [split [tmsh::pwd] /] 1]"

set obj [tmsh::get_config auth partition $partition_name default-route-domain]
set routedomainid [tmsh::get_field_value [lindex $obj 0] default-route-domain]

puts "The iApp is being instantiated in @partition $partition with default RD%$routedomainid"
if { $partition == "/" } { puts "Warning: unexpected behaviour when @partition variable is to \"/\"" }

set cfg { %BREVITY% }
set cfg [string map "@service_folder $tmsh::app_name.app @partition $partition %BREVITY% __app_service__ $tmsh::app_name.app/$tmsh::app_name " $cfg]

set fileId [open /var/tmp/cslab_salt_stack_master_v1.0.13.cfg "w"]
puts -nonewline $fileId $cfg
close $fileId

tmsh::load sys config merge file /var/tmp/cslab_salt_stack_master_v1.0.13.cfg

if {([info exists {::pm__%POOL_NAME%}]) && ([string length ${::pm__%POOL_NAME%}] > 0)} {
  if {$routedomainid != 0} {
    set cmd "tmsh::modify ltm pool %POOL_NAME% { members replace-all-with { [string map ": %${routedomainid}:" ${::pm__%POOL_NAME%}] } }"
  } else {
    set cmd "tmsh::modify ltm pool %POOL_NAME% { members replace-all-with { ${::pm__%POOL_NAME%} } }"
  }
  puts "$cmd"
  eval $cmd
  if {([info exists {::pm__%POOL_NAME%_properties}]) && ([string length ${::pm__%POOL_NAME%_properties}] > 0)} {
    set cmd "tmsh::modify ltm pool %POOL_NAME% { members modify { all { ${::pm__%POOL_NAME%_properties} } } }"
    puts "$cmd"
    eval $cmd
  }
}

puts "Finished iApp $tmsh::app_name.app generated with tmsh2iapp version 20171013.2"

A helper function that may also be useful, which I've taken from the application services integration iApp, may also be useful to insert for other situations in which tmsh2iapp has to iterate through IP addresses to determine if it should append %N route domain identifiers or not.

# Check to see if an ip has a routedomain included.
# Return: 0=false; 1=true
proc has_routedomain { ip } {
  return [string match *%* $ip]
}

RFE: be more user friendly when variables are not defined

Currently when a variable is not defined it is not checked if the variable is required or not, this could be enhanced:

  • check for required keyword in @apl of the variable
  • when required is not specified add empty values when not defined, yet this could be logged by the iApp
  • when required is specified through an error TCL command when instantiating

When doing this enhacement it should be verified that TCL error command is shown nicely in BIG-IP Controller / CC logs

APL presentation layer missing in iApp

ISSUE TYPE
  • Bug
tmsh2iapp version
20170802.2

BIGIP VERSION
[root@localhost:Active:Standalone] config # tmsh show sys version

Sys::Version
Main Package
  Product     BIG-IP
  Version     12.1.1
  Build       2.0.204
  Edition     Hotfix HF2
  Date        Fri Oct 21 17:35:48 PDT 2016
SUMMARY

My t2i file doesn't seem to have the correct variables for later use in the presentation layer of the iapp. Therefore, I do not see any configuration items when trying to create an application service. Pls let me know if I am doing anything wrong.

EXPECTED RESULTS

Something like below at the top of my t2i file.

@label(__vs_address__): Address used for the HTTP and HTTPS virtual servers
@apl(__vs_address__): display "large" validator "IpAddress"
@label(__pm__apache_servers_for_http__): Apache servers for HTTP
@label(__pm__apache_servers_for_https__): Apache servers for HTTPS
ACTUAL RESULTS
ltm node 10.10.10.10 {
    address 10.10.10.10
}
ltm pool tmsh2iapp-pool1 {
    members {
        10.10.10.10:80 {
            address 10.10.10.10
        }
    }
}
ltm virtual vs1 {
    destination 10.1.1.100:80
    ip-protocol tcp
    mask 255.255.255.255
    pool tmsh2iapp-pool1
    profiles {
        tcp { }
    }
    source 0.0.0.0/0
    translate-address enabled
    translate-port enabled
}
ltm virtual-address 10.1.1.100 {
    address 10.1.1.100
    arp enabled
    icmp-echo enabled
    mask 255.255.255.255
    traffic-group traffic-group-1
}

REPRO STEPS
  1. Configure BIG-IP via setup wizard.
  2. Create snapshot of base
[root@localhost:Active:Standalone] tmp # ./tmsh2iapp.pl snapshot-create try2-base
  1. Configure BIG-IP with pool and vs for test
  2. Create snapshot after config of L4-7 objects
[root@tmsh2iapptest:Active:Standalone] tmp # ./tmsh2iapp.pl snapshot-create try2-vspool
  1. Create t2i file
[root@tmsh2iapptest:Active:Standalone] tmp # ./tmsh2iapp.pl t2i-create try2-base try2-vspool
Written the resulting baseline file to /var/tmp/tmsh2iapp-try2-base-try2-vspool.t2i

  1. Create service
[root@tmsh2iapptest:Active:Standalone] tmp # ./tmsh2iapp.pl service tmsh2iapp-try2-base-try2-vspool.t2i 
Written the resulting iApp to tmsh2iapp-try2-base-try2-vspool.tmpl
  1. Confirm all files

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.