Nov 19, 2016

raw_iput と print

今回のPostは、raw_input()とprintを紹介したいです。二つ函数とも build-in function でございます。

>>> help(raw_input)
Help on built-in function raw_input in module __builtin__:

raw_input(...)
    raw_input([prompt]) -> string
    
    Read a string from standard input.  The trailing newline is stripped.
    If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError.
    On Unix, GNU readline is used if enabled.  The prompt string, if given,
    is printed without a trailing newline before reading.



上記の英語から、raw_input()の意味はなんとなくわかると思います。試しましょう!


>>> raw_input("input your name:")
input your name:HelloPython
'HelloPython'
>>> 
>>> name=raw_input("input your name:")
input your name:HelloPython
>>> name
'HelloPython'
>>> type(name)

>>> age = raw_input("How old are you?")
How old are you?30
>>> age
'30'
>>> type(age)


>>> print "Hello world"
Hello world
>>> a = "Hello"
>>> b = "python"
>>> print a
Hello
>>> print b
python
>>> 
>>> print a, b
Hello python

Wireless LAN Site Survey - 2

Interviewing managers and users

It is recommended to create some type of checklist or formal site survey questionnaire to use during the interview process. Some generic interview questions that will pertain to most installations are as follows:
  • Has a site survey ever been performed in the past?
  • Are any blueprints, floor plans, or any other site-specific documentation available?
    • In an office or enterprise environment, furnishing many consist of desks, cabinets, chairs, and other items.
    • In warehousing and retail environments, furnishing will include storage racks and shelving as well ass product inventories
    • In manufacturing environments, information should be gathered about the location of industrial equipment used in the manufacturing process and about equipment used to move product throughout the factory
    • In medical environments, furnishings or equipment will include devices that may cause interference and operate in the same frequency range as the proposed wireless network. Storage of items used with in the hospital or medical environment for patients and employees may also affect RF coverage
  • How many users anticipate using the wireless network?
  • Will public access be required?
  • Is there any preference for a specific manufacturer's equipment?
  • What is the coverage area?
  • Is an existing wireless network in place?
    • Existing wireless networks
    • Existing wired networks
  • Are there any known area of RF interference?
  • Are there any known areas that may lack RF coverage?
  • What type of application will be use?
  • Will voice or other applications that require quality of service be used?
  • Is roaming required?
  • Is Power over Ethernet (PoE) required?
  • What are the wireless security requirement?
  • Will an escort be required
  • Are there any legislative compliance requirements?


Above question list is from CWAP

ExtremeWireless - BYOD Lab - 6

In this post, I introduce that how to integrate Networks Access Controller (NAC) with ExtremeWireless Contoller (EWC) which includes

  • Configure NAC gateway
  • Config Authentication setting for integration

Configure NAC gateway

As you could see the following topology which we had shown in BYOD lab - 1, NAC is between EWC and Radius Server. From EWC view, NAC is the security gateway.




Configure NAC gateway

Open ExtremeManagment and Add access Control Engine, in this example, ip address is 192.168.10.3 and name is GTAC-NAC. Then, select the current profile which you created and save. 


Add EWC into NAC, Select Switches tag and Add Switches as the following
  • Set the primary Gateway parameter to the IP address of the NAC Gateway
  • Set the Auth Access Type to Network Access to set the Radius configuration type directly to the set of selected device
  • The Gateway radius attributes to send attribute selection will depend on the device type. Since the ExtremeWireless Controller supports both the Extreme Policy and RFC3580, we choose RFC 3580-VLAN ID & Extreme IdentFI Wireless.
  • Enable Radius Accounting 
Note, the Extreme IdentiFi Wireless attributes, will send the Policy/Role via the Filter-ID with the addition of the Login-LAT-Port. The Login-LAT-Port will notify the controller if the end-user is authenticated. Policies Roles such as Quarantine and Unregistered are considered non-authenticated roles.



By doing the similar way, NAC could add radius server as you could see the following picture.


At last, please do not forget to click "Enforce" button.
 

Config Authentication setting for integration

On the other side, you need to add NAC as the security gate way into wireless controller, as shown in the following picture.




Nov 14, 2016

Spine and Leaf architecture

As virtualization, cloud computing, and distributed cloud computing (Hadoop, for example) becomes more popular in the data center, a shift in the traditional three-tier networking model is taking place as well.
The traditional core-aggregate-access model is efficient for traffic that travels “North-South”, which is traffic that travels in and out of the data center. This kind of traffic is typically a web service of sorts–HTTP/S, Exchange, and Sharepoint, for example–where there is a lot of remote client/server communication. This type of architecture is usually built for redundancy and resiliency against a failure. However, 50% of the critical network links are typically blocked by the Spanning-Tree Protocol (STP) in order to prevent network loops, just to sit idly as a backup, which means 50% of your maximum bandwidth is wasted (until something fails). Here is an example:

This type of architecture is still very widely used for service-oriented types of traffic that travel North-South. However, the trends in traffic patterns are changing with the types of workloads that are common in today’s data centers: East-West traffic, or server-to-server traffic. Take a look at the diagram above. If a server connected to the left-most access switch needs to communicate with a server connected to the right-most access switch, what path does it need to take? It travels all the way to the core switch and back down again. That is not the most efficient path to take, and causes more latency while using more bandwidth. If a cluster of servers (this number can be in the hundreds, or even thousands) is performing a resource-intensive calculation in parallel, the last thing you want to introduce is unpredictable latency or a lack of bandwidth. You can have extremely powerful servers performing these calculations, but if the servers can’t talk to each other efficiently because of a bottleneck in your network architecture, that is wasted capital expenditure.
So how do you design for this shift from North-South to East-West traffic? One way is to create a Spine and Leaf architecture, also known as a Distributed Core. This architecture has two main components: Spine switches and Leaf switches. You can think of spine switches as the core, but instead of being a large, chassis-based switching platform, the spine is composed of many high-throughput Layer 3 switches with high port density. You can think of leaf switches as your access layer; they provide network connection points for servers, as well as uplink to the spine switches. Now, here is the important part of this architecture: every leaf switch connects to every spine switch in the fabric. That point is important because no matter which leaf switch a server is connected to, it always has to cross the same amount of devices to get to another server (unless the other server is located on the same leaf). This keeps the latency down to a predictable level because a payload only has to hop to a spine switch and another leaf switch to get to its destination.

Before you design an architecture like this, you will need to know what the current and future needs are. For example, if you have a server count of 100 today and that will eventually scale up to 500 servers, you need to make sure your fabric can scale to accommodate future needs. There are two important variables to calculate your maximum scalability: the number of uplinks on a leaf switch and the number of ports on your spine switches. The number of uplinks on a leaf switch determines how many spine switches you can have in your fabric–remember: every leaf switch has to connect to every spine switch in the fabric! Also, the number of ports on a spine switch determines how many leaf switches you can have; this is why spine switches need to have a high port density. Let’s take the example of 100 servers today with a need to scale to 1000 servers in the future. If we plan on using a 24-port 10Gbps switch for the leaf layer, utilizing 20 ports for servers and 4 ports for uplinks, we can have a total of 4 spine switches. If each spine switch has 64 10Gbps ports, we can scale out to a maximum of 64 leaf switches. 64 leaf switches x 20 servers on each switch = 1280 maximum servers in this fabric. Keep in mind this is a theoretical maximum and you will need to accommodate for connecting the fabric to the rest of the data center. Regardless, this design will allow for seamless scalability without having to re-architect your fabric. You can start off with 5 leaf switches and 4 spine switches to meet your current need of 100 servers and scale out leaf switches as more servers are needed.
Another factor to keep in mind when designing your fabric is the oversubscription ratio. This ratio is calculated on the leaf switches, and it is defined as the max throughput of active southbound connections (down to servers) divided by the max throughput of active northbound connections (uplinks). If you have 20 servers each connected with 10Gbps links and 4 10Gbps uplinks to your spine switches, you have a 5:1 oversubscription ratio (200Gbps/40Gbps). It is not likely that all servers are going to be communicating at 100% throughput 100% of the time, so it is okay to be oversubscribed. Keeping that in mind, work with the server team to figure out what an acceptable ratio is for your purpose.
Advantages:
  1. It is possible to use low-cost 1U or 2U Spine Switches Vs. Expensive Chassis-based Core Switches.
  2. It is possible to start small and expand the Spine/Leaf network by adding more switches, when required, without discarding the existing setup.
  3. There are networking vendors who make specialized Leaf/Spine switches.
  4. It is possible to configure the Distributed Core network to offer maximum redundancy/resiliency. Even if a Spine Switch fails, there will only be a performance degrade Vs. Service outage.
  5. It is possible to achieve higher throughput/bandwidth & connect more servers with Distributed Core networks Vs. Core-Aggregation-Edge Networks.
  6. Leaf/Spine networks can handle both East-West traffic (Server to Server: Cloud computing, Hadoop, etc.) and North-South traffic (Web content, Email, etc.) efficiently. The traditional networking model is more suitable for the latter, and expansion is limited.
  7. It is possible to use Standards-based protocols (even in a multi-vendor setup) to implement Leaf-Spine networks. But some vendors have developed their own proprietary protocols/fabrics, as well.
  8. Distributed Core networks enable Containerized (and Expandable) Data Centers.
  9. Networks can scale up/down/out massively and quickly.
  10. Can handle East-West (Server to Server) traffic efficiently.

Reference 
1. http://www.cisco.com/c/en/us/products/collateral/switches/nexus-9000-series-switches/guide-c07-730115.html
2. http://thenetworksurgeon.com/cisco-spine-and-leaf-architecture-discussion-nexus-5500-vs-6001/
3.http://www.excitingip.com/4490/distributed-coreleaf-spine-network-architecture-an-intro/

Nov 13, 2016

エスケープシーケンス

Pythonの中には1文字では表せない文字も存在します。例えば改行です。このような特別な文字を表示させないために使われるのがエスケープシーケンスです。

エスケープシーケンス意味
¥¥「¥」文字そのもの
¥'シングルクオーテーション
¥"ダブルクオーテーション
¥aベル
¥bバックスペース
¥f改ページ
¥rキャリッジリターン
¥n改行
¥t水平タブ
¥v垂直タブ
¥N{name}Unicode データベース中で名前 name を持つ文字
¥uxxxx16ビットの16進数値xxxxを持つUnicode文字
¥Uxxxxxxxx32ビットの16進数値xxxxxxxxを持つUnicode文字
¥ooo8進数oooを持つASCII文字
¥xhh16進数hhを持つASCII文字
¥0NULL
¥+(改行)文字列を途中で改行する

しかし、もしここで ¥ 元の意味を表せたい場合はどうすればいいですか?例えば、


>>> dos = "c:\news"
>>> dos
'c:\news'
>>> print dos
c:
ews


上記のご覧の通り、Print で出力された文字列は問題があります。この時、"r" を利用しましょう。すると、

>>> dos = r"c:\news"
>>> print dos
c:\news
>>> print r"c:\news\python"
c:\news\python
>>> 

"r"を使用すると、¥元の意味が正しく表示されます。

文字列

文字列(String)は、0あるいは0以上文字から構成されたものです。S=a[1]a[2]...a[n]。
Pythonのなかに全てのものは Object と定義されます。例えば、”Hello, World”は Objectである。文字列のObject Type は、Str で表示されます。文字列タイプの Objectは ’’、あるいは "" を囲まれます。例えば、

>>> "I love Python"
'I love Python'
>>> 'I love Python too'
'I love Python too'

>>> 

また、Python の中には、type()の関数を使い、Object Type が確認できます。例えば、

>>> 250
250
>>> type(250)
>>> type("250")


しかし、下記の文字列を入力した時、このような結果が出力されます。

>>> 'what's your name'
  File "", line 1
    'what's your name'

          ^
SyntaxError: invalid syntax

ここで、SyntaxError:invalid syntax が出力されました。invalid syntax は無効の文法でございます。この解決は以下の2つがあります。

1.""を使います

>>> "what's your name"
"what's your name"

2.\ を使います

>>> 'what\'s your name'
"what's your name"


Pythonの中に”変数はTypeがない、ObjectはTypeがあり”と言われます。変数はラベル見たいものでございます。Objectにラベルを貼ることができます。

>>> b = "hello,world"
>>> b
'hello,world'
>>> print b
hello,world
>>> type(b)

また、”+”を使い、二つの文字列を繋げることができます。例えば、

>>> "py" + "thon"
'python'

下記のプログラムを実行すると、エラーを出力されます。

>>> a = 1234
>>> b = "Glod"
>>> 
>>> print b + a 
Traceback (most recent call last):
  File "", line 1, in
TypeError: cannot concatenate 'str' and 'int' objects

出力されたメッセージの意味は、StrのType と IntのType を繋げることができないということです。

>>> print b + str(a)
Glod1234

>>> print b + `a`
Glod1234

>>> print b + repr(a)
Glod1234

実は、repr()という関数は``の代理品ようなものでございます。repr()関数は与えた値と等価な値を返す。




Wireless LAN Site Survey - 1

The main objectives of a wireless LAN site survey are to find areas of RF coverage and interference source as well as installation locations for hardware infrastructure devices such as access points, antennas and any other devices that will be used with the wireless LAN.

Knowing the expectation of the client or business in regard to the wireless LAN is a critical part of a successful Wireless LAN Site Surveys. To understand these client expectations, it is necessary to gather much information. The scope of the wireless LAN Site Surveys is dependent on many factors, some of which include:

  • Size of physical location
  • Intended use of the network
  • Number of users
  • Performance expectations

Size of Physical Location

Depending on the size of the physical location in which the wireless network will be installed, a complete wireless LAN site survey may not be necessary. For example, one sandwich shop is approximately 1,200 square fee, has seating for about 15 people. In this case, a single access point would be sufficient for the number of users who access the wireless network at any one time. Although a full-blown site survey determining areas of RF interference coverage and interference would more than likely not be required, it would still be beneficial to visit the location and determine the best place for the access point. In a situation like this, a site survey may be all that is necessary. This would include testing the are to determine the best RF channel to use as well as access point mounting, and connecting to the wired network for access to Internet. 

Intended use of the network

The intended use of this wireless network will consists of staying online and browsing the Internet or checking email. It is unlikely many users would be performing any high-end or bandwidth intensive application on this type of connection. 

Number of users

As the number of actual users grows, the need for additional access points will also increase.

Performance expectations

Keeping in mind that wireless networks are half-duplex and contention-based, many factors will affect the performance of a wireless LAN, including the number of users, types of applications used, location, and the number of infrastructure devices providing access. 

Basic RF Antenna Concepts - 3

WLAN Antenna Types

Three common types of antennas for use with wireless LANs are:

  • Omnidirectional / Dipole antennas
  • Semi-directional antennas 
  • Highly directrional antennas

Omnidirectional Antennas

Omnidirectional antennas are very common on most access points. An omnidirectional antenna has a horizontal beamwidth of 360. The vertical beamwidth will vary depending on the antenna's gain. As the gain of the antenna increases, the horizontal radiation pattern will increase, providing more horizontal coverage. However, the vertical radiation pattern will decreases, therefore providing less vertical coverage.

The shape of the radiation pattern from an omnidirectional antenna looks like a donut, as shown in the following picture.

 
Above picture from CWAP

Omnidirectional antennas are one of the most common type of antennas for indoor wireless LAN deployments. Most of this type antenna typically has a low gain of 2 dBi or 3 dBi and connects directly to an access point. 

Azimuth and elevation charts are usually available to allow  visualization of the RF radiation pattern emitted from the antenna, as shown in the following picture. 


Semidirectional Antennas

Semidirectional antennas take power from the transmitting system and focus it into more specific pattern than an omnidirectional antenna offers. Semidirectional antennas are available in various types, including patch, panel, sector and Yagi. 

Patch/Panel

In the wireless LAN world, the terms patch and panel are commonly used to describe the same type of antenna. A patch/panel antenna can have a horizaontal beamwidth of as high as 180, but usually the horizontal beamwidth is between 50 and 80. The following picture shows a 2.4Ghz flat patch antenna. 

above picture from CWAP

Azimuth and elevation charts are available for patch/panel antennas, as shown in the following picture. 

Sector

Sector antennas are often used for base station connectivity for point-to-multipoint connectivity. Sector antennas have an azimuth that varies from 90 from 180. The following are pictures for sector antennas.

above pictures from CWAP.

Yagi 

Yagi antennas are designed to be used indoors in long hallways and corridors, or outdoors for short-range bridging. Yagi antennas have vertical and horizontal beamwidths range from 25 to 65. The following are pictures for Yagi antennas.


Highly Directional Antennas

Highly directional antennas are typically parabolic dish antennas used for long-range point-to-point bridging links. Some manufacturers of parabolic dish antennas advertise ranges of 25 miles or more. Parabolic dish antennas have very narrow horizontal and vertical beamwidths. This beamwidth can range from 3 to 15. The following are pictures for Highly directional antennas.