Another word I’ve heard buzzing around lately, microservices works to brings cloud and containers a step further and modularizes the application into smaller function-specific mini applications that work together through APIs. With this approach, the elasticity of the cloud is tuned to the needs of the subscribers, and the business only pays for the network and compute resources they need on a more granular level. The early adopters at this point are the usual suspects: Airbnb, Uber and Netflix.

“the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.”

Principals of Microservices (PPT)

Cisco’s APIC-EM, or Application Policy Infrastructure Controller Enterprise Module is an OpenDayLight based SDN (Software Defined Network) controller. You could also possibly call it Cisco’s attempt to Merakify the Enterprise. On the bright side, it’s a free virtual appliance and no license is required.

One of the biggest features of APIC-EM is called Network Plug and Play

At a high level, the Cisco switch or router talks to the APIC-EM to streamline workflows and automate deployments. Switches and routers, known as agents discover the controller using any of the following mechanisms in order:

dhcp option 43 or dns (below), usb key, cloud discovery (currently beta), or the smartphone app.

DHCP

option 43 ascii "5A1N;B2;K4;I172.19.45.222;J80"

The option 43 string has the following components, delimited by semicolons:

  • 5A1N;—Specifies the DHCP suboption for Plug and Play, active operation, version 1, no debug information. It is not necessary to change this part of the string.
  • B2;—IP address type:
    • B1 = hostname
    • B2 = IPv4 (default)
  • Ixxx.xxx.xxx.xxx ;—IP address or hostname of the APIC-EM controller (following a capital letter i). In this example, the IP address is 172.19.45.222.
  • Jxxxx —Port number to use to connect to the APIC-EM controller. In this example, the port number is 80. The default is port 80 for HTTP and port 443 for HTTPS.
  • K4;—Transport protocol to be used between the Cisco Plug and Play IOS Agent and the server:
    • K4 = HTTP (default)
    • K5 = HTTPS

DNS

APIC-EM: pnpserver.<customerdomain>.com
NTP Server: pnpntpserver.<customerdomain>.com

The DHCP pool will need to either be on vlan 1, or you’ll need to specify a staging vlan on the upstream switch:

pnp startup-vlan 55

That brings me to another caveat of of Plug and Play is that the firmware needs to be supported, and may not match the shipping version of the hardware!

Another feature of APIC-EM is called Easy QoS

I actually really like this use-case for network programmability. It’s important for the policies to match end-to-end in QoS, so being able to roll out policies and get insights into your policy-maps holistically is kind of a big deal.

APIC-EM documentation gives the concept of Northbound, which is the REST API you can use for custom applications, and Southbound in which APIC-EM talks to hardware using SNMP and CLI. Cisco states “future APIC-EM releases will leverage other southbound technology such as NetConf as they become available”.

I found some Postman collections from CiscoDevNet’s Github page here. Postman collections are a great way to learn by doing.

APIC-EM Firmware Compatibility

Official Getting Started Guide

When you change your dogs food, they get sick all over the place, they just can’t stomach change. As an IT professional, the dog food we know and love changes frequently.. The technology you spent all that time learning about last year is obsolete.

Don’t get mad, adapt! As a collaboration engineer, my title didn’t exist 20 years ago. During the TDM to VoIP migration, analog teleco guys were forced to adapt or find new work. When virtualization came on the map, the ability for one person to manage hundreds of servers meant that the early adopters got a new title and quite possibly a pay raise, while the ones late to the game found themselves no longer needed.

This blog is adapting, too. Let me throw out a few buzzwords: API, IoT, REST. Knowing what they mean and why they are important might save you from being the next casualty of change. It’s about asking more from technology. People don’t expect their GPS to just give them directions anymore. They want voice navigation with social networking that tells you where the cops are hiding, and they want it to predict when you’re leaving to go to work and tell you how to traffic is. From a development perspective, the GPS apps with the most APIs get the most love, and almost everything is OPEN, meaning you or I could “tap” into that technology, helping both parties.

I recently gave a presentation on coding along with the CTO of the company, Vinu Thomas. One of the points he made that really stuck was this: try to automate your own job. If you’re smart enough to do that, I promise you’ll be just fine.

I started asking during phone migrations: why do I have to tell the router what the new phone’s mac address is, if the switch already knows? Why can’t the switch and the router work this out between themselves ? Why do call center agents have to login to their phone every day if they also login to their computers ? I think we’re almost there, if not already. Both of these use cases: extension mobility and ios-xe have APIs. So do yourself a favor, hang in there, and learn Python.. or Ruby or my favorite: Node.js

#1 – request

Request is the easiest way to make REST calls. It runs server-side to hide your token and if you use Postman to test the HTTP request, it can even generate the code for you!
https://www.npmjs.com/package/request

Example Request Using Spark Messages API:

var request = require(‘request’);
var req = {
  auth: { bearer: ‘sparkTokenHere’ },
  url: ‘https://api.ciscospark.com/v1/messages’,
  json: true,
  body: {
    ‘roomId’: roomId,
    ‘text’: message
    }
};//end setup

request.post(req, function(err, res) {
if(err) {
console.log(err);
} else {
  }
});//end rest call


#2 – picker

Picker is a server side router for Meteor that works alongside middleware to easily provide an API or webhook into your application.
https://atmospherejs.com/meteorhacks/picker

Example Webhook with JSON parsing using body-parser:

Picker.middleware(bodyParser.json());
Picker.middleware(bodyParser.urlencoded({extended: false}));
Picker.route(‘/myWebhook’, function(params, request, response) {
  personEmail = (request.body.data.personEmail);
  msgid = (request.body.data.id);


#3 – Q

Before getting too far ahead with node.js, you’ll need to grasp the underlying language, javascript. Javascript is a synchronous language, meaning it runs functions all at the same time, which can make a mess of things if you don’t use callbacks properly. Q uses something called promises to run things asynchronously in the order you tell it. To learn more about callbacks and why this package is so necessary, check out callbackhell.com
http://documentup.com/kriskowal/q/

Example of promises with Q:

Q.fcall(promisedStep1)
.then(promisedStep2)
.then(promisedStep3)
.then(promisedStep4)
.then(function (value4) {
// Do something with value4
})
.catch(function (error) {
// Handle any error from all above steps
})
.done();


#4 – bert

Bert makes notifications simple
https://github.com/themeteorchef/bert

Bert.alert({
  title: ‘Conference Now’,
  message: ‘Connecting to Tropo…’,
  type: ‘info’,
  style: ‘growl-bottom-right’,
  icon: ‘fa-phone’
});


#5 – fontawesome

fontawesome is a collection of 675 icons in unicode that can be embedded in your site with a single tag. Most people will use their built in CDN (content delivery network) to make deployment even easier.
http://fontawesome.io/icons/

<i class=fa fa-camera-retro”></i>


#6 – nodemailer

nodemailer is the best email package hands down. It supports an html body and allows you to specify options within the app.
https://www.npmjs.com/package/nodemailer

var nodemailer = require(‘nodemailer’);

// create reusable transporter object using the default SMTP transport
var transporter = nodemailer.createTransport(‘smtps://user%40gmail.com:pass@smtp.gmail.com:587’);

// setup e-mail data with unicode symbols
var mailOptions = {
  from: ‘”Fred Foo 👥” <foo@blurdybloop.com>’, // sender address
  to: ‘bar@blurdybloop.com, baz@blurdybloop.com’, // list of receivers
  subject: ‘Hello ✔’, // Subject line
  text: ‘Hello world 🐴’, // plaintext body
  html: ‘Hello world 🐴‘ // html body
};

// send mail with defined transport object
transporter.sendMail(mailOptions, function(error, info){
  if(error){
  return console.log(error);
  }
console.log(‘Message sent: ‘ + info.response);
});


#7 – validator

Need to check if an email is actually an email? A dollar amount is actually a dollar amount? Validator has a ton of built-in methods to check for you.
https://www.npmjs.com/package/validator

var validator = require(‘validator’);
validator.isEmail(‘foo@bar.com’); //=> true


#8 – csv

While ECMA 5 has native XML and JSON support, a lot of Cisco applications still rely on CSV (comma seperated values). This package aims to bridge the gap.
https://www.npmjs.com/package/csv

var csv = require(‘csv’);
csv.parse(data, function(err, data){
  csv.stringify(data, function(err, data){
  process.stdout.write(data);
  });
});


#9 – bootstrap

Boostrap is so useful, I wish it was just included in HTML period. Any buttons, menus, fonts, tables, grids, layouts, etc. are super easy with Bootstrap.
https://www.npmjs.com/package/bootstrap

Just include the bootstrap code below to utilize their CDN:

<!– Latest compiled and minified CSS –>
<link rel=”stylesheet” href=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css” integrity=”sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u” crossorigin=”anonymous”>

<!– Latest compiled and minified JavaScript –>
<script src=”https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js” integrity=”sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa” crossorigin=”anonymous”></script>


#10 – jsPDF

PDFs are still the industry standard for “digital hard copies” of documents. jsPDF makes generating PDFs easy.
https://parall.ax/products/jspdf

<script src=”https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js”></script>
var pdf = new jsPDF();
pdf.text(30, 30, ‘Hello world!’);
pdf.save(‘hello_world.pdf’);